Hi this should be simple -
I just need to refer to a variable in an SQL string in my VB code.
The string is -
rstUpdate.Open "SELECT * FROM [Customer Orders] WHERE [Cancel Booking] = False AND [Date Ordered] > #08-20-02# AND [Tour Date] > #" & Format(Date, "dd-mm-yy"
& "# AND [Invoiced] = False AND [Payment Type] = 'Invoice' AND [Customer Name] = '" & CustomerName & "'", conn, 1, adLockOptimistic
The variable argument I'm having trouble with is in the WHERE clause where it refers to CustomerName. CustomerName is a variant type variable which contains text data. What is the correct way to refer to a control or variable in an SQl string in VB. Dates are easy, just put some #'s around the outside eg #" & startDate & "# should works fine, but what about text???
help aprreciated!
cheeers
I just need to refer to a variable in an SQL string in my VB code.
The string is -
rstUpdate.Open "SELECT * FROM [Customer Orders] WHERE [Cancel Booking] = False AND [Date Ordered] > #08-20-02# AND [Tour Date] > #" & Format(Date, "dd-mm-yy"
The variable argument I'm having trouble with is in the WHERE clause where it refers to CustomerName. CustomerName is a variant type variable which contains text data. What is the correct way to refer to a control or variable in an SQl string in VB. Dates are easy, just put some #'s around the outside eg #" & startDate & "# should works fine, but what about text???
help aprreciated!
cheeers