devxlogo

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.

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Engineering Leaders Spot Weak Proposals

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.