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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Creating Dynamic SQL

Question:
I'm trying to develop a dynamic query handler within VB that will prompt users for parameters as set up in the parameter list in MS Access (v1.1). I wish to dynamically build the param list with .listparameters (at run time) and then use this list to assign values to these same parameters. My problem is that VB/Access will not allow assignment of values to parameters without explicitly referring to actual parameter names in code (ie. a using a string/variable as returned by .listparameters to refer to such parameters is apparently not possible).

Answer:
The way I've done this in the past is to dynamically generate the actual SQL needed to do the query. It's a lot more reliable and clear than trying to deal with parameters, which Access/VB doesn't do very well. As the users select pieces of data to query on, you build up the SQL statement to retrieve the appropriate data.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date