473,233 Members | 1,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

Syntax error (missing operator) in query expression - works for one form but not anot

1
I used this code to successfully run a report on a single record on one table/form but when I applied it to another table/form it comes-up with:

Syntax error (missing operator) in query expression 'FirmName=Smith Management Corporation'.

What am I missing?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command364_Click()
  2. On Error GoTo ErrHandler
  3. DoCmd.OpenReport ReportName:="FirmSummary", View:=acViewPreview, _
  4. WhereCondition:="FirmName=" & Me.FirmName
  5. Exit Sub
ErrHandler:
Expand|Select|Wrap|Line Numbers
  1. ' Don't show error message if report was canceled
  2.     If Err <> 2501 Then
  3.         MsgBox Err.Description, vbCritical
  4.     End If
  5. End Sub
Aug 8 '19 #1

✓ answered by twinnyfo

Nmadau,

Welcome to Bytes!

You need single quotes in your where clause:

Expand|Select|Wrap|Line Numbers
  1. WhereCondition:="FirmName='" & Me.FirmName & "'"
Please note, you will have to make those straight quotes. I am typing on my iPad and it canít un-curl those quotes.

Hope this hepps!

2 1415
twinnyfo
3,653 Expert Mod 2GB
Nmadau,

Welcome to Bytes!

You need single quotes in your where clause:

Expand|Select|Wrap|Line Numbers
  1. WhereCondition:="FirmName='" & Me.FirmName & "'"
Please note, you will have to make those straight quotes. I am typing on my iPad and it canít un-curl those quotes.

Hope this hepps!
Aug 9 '19 #2
NeoPa
32,554 Expert Mod 16PB
As Twinny says, that code cannot possibly work as it stands (See Quotes (') and Double-Quotes (") - Where and When to use them). I suspect you had one that worked which used a numeric field.
Aug 18 '19 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: alexz | last post by:
valuA = (request.form("toadd")) If valuA = "" then SQL = "UPDATE CourseReg SET attended='Active' WHERE ID IN("&request.form("toadd")&")" Set RS = MyConn.Execute(SQL) End If MyConn.Close Set...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
3
by: Lumpierbritches | last post by:
Syntax Error (missing operator) in query expression =BLANK'S MOLLIE-PRINCE BRUISER-3/14/2004-03 AnimalID is correct. I'm trying to open with a command button or double click the frmAnimal from a...
4
by: khan | last post by:
getting, error, 3075 Syntax Error (Missing Operator) in query expression '8WHERE .=1' Dim TotalQty As Integer TotalQty = DLookup("", "", "=" & Forms!!)
1
by: Justin R | last post by:
Hey I am really stuck and can't figure out what is wrong here is the code line and surrounding code, if anyone can help i would appreciate it. Thanks This first line is the line that has a problem...
4
by: thebarefootnation | last post by:
Hi I have the following error message "Syntax Error (missing operator) in query expression" occurring when I am trying to update combo box within a form. My code is: Dim strSQL As String
6
by: Dave Richardson | last post by:
Hi to everyone, I have the following problem which is producing the following error: Syntax error (missing operator) in query expression '(CourseNo = CN1863) This caused from the follOwing...
2
by: Dilip Krishnan | last post by:
Syntax error (missing operator) in query expression 'Serial Number = 'L3FW341''. The Serial Number field is declared as text in Access Db. I am not sure which operator is missing in my command! ...
2
by: pptechs | last post by:
Hello. In dying need of assistance. All I am trying to do is search a table for a valid user ID for a form login screen and I am getting error : "Run-time error 3075 syntax error (missing...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.