473,386 Members | 1,752 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,386 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 5503
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.