Tu Quach wrote:
I have an error with the following code
Dim rs As DAO.Recordset
Set dbs = CurrentDb
strSQL = "SELECT * FROM table1 WHERE table1.Schedule_Item LIKE
""AA"" AND table1.Item1 = " & Form!Item1
Set rs = dbs.OpenRecordset(strSQL, dbOpenDynaset)
How can I fix it, anyhelp would be great
Thank you
--------------------------------------------------------------------------
Dim strSQL As String
strSQL = "SELECT Table1.* FROM Table1 " & _
"WHERE Table1.ScheduleItem Like ""AA"" AND Table1.Item1 = '" & 1 & "'"
I substituted the number 1 for Form!Item1. Did you notice I surrowned the 1
with a single quote. I figured Item1 is a text value, not numeric. Remember,
text items need to be surrounded by quotes, dates with #, and numbers have
nothing.
PS. If you post messages with error numbers, most people responding WILL NOT
look up the error codes to determine what it is. You might want to supply the
description of error codes in future posts. Since I didn't look it up, the
above may not have solved your problem.