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

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
Thanks for your registration, follow us on our social networks to keep up-to-date