Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query that lets the user select the field to be queried

Status
Not open for further replies.

jhulbert

MIS
Oct 27, 1999
4
US
I have a DB that contains name, dept and 20 date fields. These fields are test certifications. The user wants to query the DB by selecting the certification field and a date range.

In SQL sort of like this

SELECT [forms]![cert]![type]
FROM [Training Table]

How on earth can I pass the value of a combo or list box that selects the field to be queried?

Thanks in advance
 
Dynamically create the SQL statement in a string variable.

dim sql string

sql="select " & [forms]![cert]![type] & " As CertVal From TrainingTable"

The use the variable "sql" to query the database and populate the text box. Terry
 
WOW! Thanks for the quick reply.

I'm not much of a programmer. What do I do with this?

I'm pretty good at reverse engineering though. Any examples I could follow?

Thanks in advance

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top