|
-
Mar 14th, 2000, 05:07 AM
#1
Thread Starter
Addicted Member
Hello, from reading some posts earlier I came up with this code to use sql to retrieve records. Please tell me what I am doing wrong.
rs.open "Select * From Table1 Where Number = '%" & MyVar1 & "%", ConnectString, adOpenStatic, adLockOptimistic
The MyVar1 is a is a numeric value since the Number field is a numeric value. It does not work however, can someone please help.
Thanks,
Thai
-
Mar 14th, 2000, 07:04 AM
#2
Hyperactive Member
It's hard to say based purely on what you have shown, but I presume you are opening a connection before you attempt to open the recordset. Other than that I see no need for the percentage signs. If that doesn't try using an error handler to trap the specific error you are getting.
-
Mar 14th, 2000, 07:15 AM
#3
Frenzied Member
Try:
rs.open "Select * From Table1 Where Number = " & MyVar1, ConnectString, adOpenStatic, adLockOptimistic
Pattern matching isn't used with the equal operator ('='), it's used with the like operator ('like'). The other thing wrong with your statement is you have a single quote that has no matching single quote.
-
Mar 14th, 2000, 07:27 AM
#4
Thread Starter
Addicted Member
thanks
that worked, thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|