Solved Syntax Error - Brain Fart (1 Viewer)

NearImpossible

Registered User.
Local time
Today, 05:07
Joined
Jul 12, 2019
Messages
225
Having a brain fart and can't seem to figure this one out, please point out the obvious that I am missing :)

my code is erroring with "Run-Time error '3075': Syntax error (missing operator) in query expression "InvoiceDetailID='23".

Code:
Dim rs As Recordset
Dim s As String

Set rs = CurrentDb.OpenRecordset("Select * from [dbo_FacilityInvoiceEquipment] Where 'InvoiceDetailID ='" & Me.InvoiceDetailID & "'", dbOpenDynaset, dbSeeChanges)
 

Gasman

Enthusiastic Amateur
Local time
Today, 10:07
Joined
Sep 21, 2011
Messages
14,038
Numbers do not have single quotes. :(
 

NearImpossible

Registered User.
Local time
Today, 05:07
Joined
Jul 12, 2019
Messages
225
Numbers do not have single quotes. :(
i knew it was something simple, I had no single quotes originally and had an extra double quote at the end that was killing me, always the little things......

Thanks again for your assistance !!
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 10:07
Joined
Sep 21, 2011
Messages
14,038
Put the sql string into a string variable. Then you can debug.print it, until you get it correct. Then you can use that in place of the actual string.
 

Users who are viewing this thread

Top Bottom