I have the following line of code that generates "Syntax error (missing operator) in query expression 'where dbo_ZSSP_Coupons.ID='46". On the rsdbpen StrCoupon
The code is in the LostFocus of a text box named ID_Number, into which I have entered 46 then tabbed out of the box. Here is the code.
'----------Set up SQL Query----------------------------------------
Dim StrCoupon As Variant
StrCoupon = "SELECT dbo_ZSSP_Coupons.Id_Number,"
StrCoupon = StrCoupon + " dbo_ZSSP_Coupons.CAddress,"
StrCoupon = StrCoupon + " dbo_ZSSP_Coupons.CDateTime,"
StrCoupon = StrCoupon + " where dbo_ZSSP_Coupons.ID_Number='" & Me.ID_Number & "'"
'----------Set Connection To Database-----------------------------------
Dim cnndbo As ADODB.Connection
Set cnndbo = CurrentProject.Connection
Dim rsdbo As New ADODB.Recordset
rsdbo.ActiveConnection = cnndbo
rsdbo.CursorType = adOpenDynamic
'---------Send Query to Server-----------------------------------------
rsdbpen StrCoupon
This code was copied and from another application that works, but I have changes lables. I have compared the two and they match. So I have no clue.
Thanks in advance
jpl
The code is in the LostFocus of a text box named ID_Number, into which I have entered 46 then tabbed out of the box. Here is the code.
'----------Set up SQL Query----------------------------------------
Dim StrCoupon As Variant
StrCoupon = "SELECT dbo_ZSSP_Coupons.Id_Number,"
StrCoupon = StrCoupon + " dbo_ZSSP_Coupons.CAddress,"
StrCoupon = StrCoupon + " dbo_ZSSP_Coupons.CDateTime,"
StrCoupon = StrCoupon + " where dbo_ZSSP_Coupons.ID_Number='" & Me.ID_Number & "'"
'----------Set Connection To Database-----------------------------------
Dim cnndbo As ADODB.Connection
Set cnndbo = CurrentProject.Connection
Dim rsdbo As New ADODB.Recordset
rsdbo.ActiveConnection = cnndbo
rsdbo.CursorType = adOpenDynamic
'---------Send Query to Server-----------------------------------------
rsdbpen StrCoupon
This code was copied and from another application that works, but I have changes lables. I have compared the two and they match. So I have no clue.
Thanks in advance
jpl