Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Finding Variable Values

Question:
Data1.Recordset.FindFirst "LastName = 'Quayle'"
Ok that works fine. Why can't I:
Data1.Recordset.FindFirst "LastName = VarLN"
where VarLN is a variable which the user has just provided? I get error 3070, "Can't bind VarLN". What's wrong here?

Answer:
You can't embed a variable name within quotes. Here's how your line should look:

Data1.Recordset.FindFirst "LastName = '" & VarLN & "'"
You have to remember to put the single quotes around the string variable value, so that when the variable's value is inserted, it is correctly formatted.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date