473,320 Members | 1,953 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,320 software developers and data experts.

Syntax Error (missing operator) in query expression

Syntax Error (missing operator) in query expression [AnimalID]=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 subform that uses the same table, is that my problem?

If I remove the criteria from the expression, it opens the form, but to show
every record.
Michael
Nov 12 '05 #1
3 5499
lu*************@aol.com (Lumpierbritches) wrote in
news:20***************************@mb-m16.aol.com:
Syntax Error (missing operator) in query expression
[AnimalID]=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 subform that uses the
same table, is that my problem?

If I remove the criteria from the expression, it opens the
form, but to show every record.
Michael


Iwhat you need to see is
[AnimalID]="BLANK'S MOLLIE-PRINCE BRUISER-3/14/2004-03"

review the location in the button's OnClick event to add extra
quotes. If you can't figure it out, post the relevant sections of
code.

Bob Quintal

Nov 12 '05 #2
Private Sub cmdOpenAnimal_Click()
On Error GoTo Err_cmdOpenAnimal_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmAnimal"

stLinkCriteria = "[AnimalID]=" & "'" & Me![AnimalID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenAnimal_Click:
Exit Sub

Err_cmdOpenAnimal_Click:
MsgBox err.Description
Resume Exit_cmdOpenAnimal_Click

End Sub

Nov 12 '05 #3
On 27 Apr 2004 00:12:01 GMT, Lumpierbritches wrote:
Private Sub cmdOpenAnimal_Click()
On Error GoTo Err_cmdOpenAnimal_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmAnimal"

stLinkCriteria = "[AnimalID]=" & "'" & Me![AnimalID] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenAnimal_Click:
Exit Sub

Err_cmdOpenAnimal_Click:
MsgBox err.Description
Resume Exit_cmdOpenAnimal_Click

End Sub


Your problem is you have a single quote in the criteria field....

[AnimalID]=BLANK'S MOLLIE-PRINCE BRUISER-3/14/2004-03

So your Where clause is failing when it hits the ' in Blank's.

Try it this way (instead of using & "'" etc.)

stLinkCriteria = "[AnimalID]=" & chr(34) & Me![AnimalID] & chr(34)

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.