str1 = "SELECT * FROM CancelTracking WHERE [Tracking#]= " & txtTracking & ";"
This assumes that Tracking# is numeric. BTW, I have had a lot of trouble with field names that include # because Access uses the # sign to set off dates.
str1 = "SELECT * FROM CancelTracking WHERE [Tracking#]= & txtTracking ;"
A couple of things wrong. Anything within the quotes will be treated as text, so you need to resolve the variable before putting it in the string (str1). Also, a text variable must be surrounded by quotes. chr$(34) equals "
str1 = "SELECT * FROM CancelTracking WHERE [Tracking#]= "
str1 = str1 & chr$(34) & txtTracking & chr$(34)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.