SQL Syntax issue

motleyjew

Registered User.
Local time
Today, 18:02
Joined
Jan 11, 2007
Messages
109
I am using the folling code in a after update combobox event:

Dim rst As DAO.Recordset
Dim sqlwhere As String

sqlwhere = " "

If IsNull(Me.comboSearchSerial) = False Then
sqlwhere = "SerialNumber='" & Me.comboSearchSerial & "' and "
End If


mysql = "SELECT TBL_RMA.* from [TBL_RMA] Where "
mysql = mysql & sqlwhere
mysql = mysql & ";"
Forms!FRM_RMA.RecordSource = mysql

Exit_comboSearchSerial_AfterUpdate:

This is currently working for me with SerialNumber being a text field. I would like to use the same code substituting SerialNumber with a Date field. I know its probly an issue with the use of quotes, but I can't seem to figure it out. Also, if I wanted to use a number format, what would I use...
Thanks
Gregg
 
sqlwhere = "SerialNumber = #" & Date & "#"

for a date, or

sqlwhere = "SerialNumber = " & Number

for a number
 
Worked like a charm. Thanks for the quick reply and great information.

Gregg
 

Users who are viewing this thread

Back
Top Bottom