473,651 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5524
lu************* @aol.com (Lumpierbritche s) 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_C lick()
On Error GoTo Err_cmdOpenAnim al_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmAnimal"

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

Exit_cmdOpenAni mal_Click:
Exit Sub

Err_cmdOpenAnim al_Click:
MsgBox err.Description
Resume Exit_cmdOpenAni mal_Click

End Sub

Nov 12 '05 #3
On 27 Apr 2004 00:12:01 GMT, Lumpierbritches wrote:
Private Sub cmdOpenAnimal_C lick()
On Error GoTo Err_cmdOpenAnim al_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmAnimal"

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

Exit_cmdOpenAni mal_Click:
Exit Sub

Err_cmdOpenAnim al_Click:
MsgBox err.Description
Resume Exit_cmdOpenAni mal_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
3081
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 RS = Nothing Set MyConn = Nothing
29
2477
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" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" & REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE("GenKTitles.
4
18044
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 on me for some reason. The Summary field is pulled from a Rich Text Editor that allows HTML formatting and appears to be the culprit, but I just can't seem to figure out why. Any guidance is greatly appreciated. I'm connecting to an Access...
3
300
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 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.
4
18217
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
4642
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 and the following after the big gap is the whole thing. MySet.FindFirst Criteria ' Locate first occurrence. Option Compare Database 'Use database order for string comparisons Private Sub Form_BeforeUpdate(Cancel As Integer) ' Me!...
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8460
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8576
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.