3075 Syntax Error

scotthutchings

Registered User.
Local time
Today, 08:21
Joined
Mar 26, 2010
Messages
96
I am receiving the following error:
3075 Syntax error (missing operator) in query expression 'Project Name = "Scott's Training Project(21)"'. at 'cmbCONumber_NotInList"​

when my Dlookup code runs. Here is the code:

Code:
    Dim Project As String
Dim strMessage As String
Dim rs As Recordset
Dim PTR As Variant
strMessage = "Change Order #'" & NewData & "' appears to be a new change quote.  Do you want to create a new change quote?"
If Confirm(strMessage) Then
    Set rs = CurrentDb.OpenRecordset("PM - Change Order")
    Project = Forms![PM - PM Change Orders]![cmbProjectName]
    PTR = DLookup("TaxRate", "Project File", "Project Name = """ & Project & """")

Any Ides? It looks correct in the debug.print.

Thanks in advance.
Scott.
 
What is your code suppose to do? Which line of code throws the error?
Have you tied stepping through the code(F8)?
 
The code is to look up the tax rate for a project called [Project Name] (a primary key) and assign it to the variable PTR. The error comes when the PTR = DLookup... code runs.
 
The code you are showing does not fit the error message. You probably have the usual stuff with apostrophes in strings in the Not_in_list event of the combo
 
not sure if this is the reason

Scott's

try replacing with

='" & replace(Project,"'","''") & "'")

which replaces a single quote with a double single quote
 

Users who are viewing this thread

Back
Top Bottom