VB Code:
strSerialNo = "2" set rsmulti = dbname2.OpenRecordSet("SELECT * FROM Phrase2 where SerialNo = " & strSerialNo & " ",dbOpenDynaset)
can anyone tell me whats wrong with this function ? it cant work
Printable View
VB Code:
strSerialNo = "2" set rsmulti = dbname2.OpenRecordSet("SELECT * FROM Phrase2 where SerialNo = " & strSerialNo & " ",dbOpenDynaset)
can anyone tell me whats wrong with this function ? it cant work
It always helps to state what is going wrong rather than just stating it doesn't work.
What happens when you run this? Are you getting an error? If so, what does the error say?
It looks like you are using a string variable. Strings need to be encapsulated in single quotes when used in querys.VB Code:
"SELECT * FROM Phrase2 where SerialNo = '" & strSerialNo & "' "
erm it got some errors like....data type mismatch in criteria expression
string variables should be specified within single quotes.
Check it out:
strSerialNo = "2"
set rsmulti = dbname2.OpenRecordSet("SELECT * FROM Phrase2 where SerialNo = '" & strSerialNo & "' ",dbOpenDynaset)