I have a table called inventory as following
id code qty
1 -A-B- 10
2 -G-H- 11
3 -O-G- 4
id is auto generated, code is text, qty is integer
i use a form to list the record from the table, the only criterion is the code of the record must be Instr("-O-G-H-" ,[code])>0 , ie the code of the record must be a substring of "-O-G-H-" , how do i make the sql string?
I tried this (just the crucial lines)
nostr = "-O-G-H-"
Me.RecordSource = "SELECT * FROM inventory WHERE ((InStr('" & nostr & "', code)) > 0);"
It pull some record out but the records are wrong, the code is not substring of the nostr.
Any idea?