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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

generate a SELECT query from VBA code.

Status
Not open for further replies.

scroce

MIS
Nov 30, 2000
780
US
I have a form that has 3 combo boxes and two checkmarks on it for the user to limit criteria searched. Specifically:

cboSalesRep
cboAgentName
cboCategory
chkLineOfBiz1
chkLineOfBiz2

After the user selects their criteria in these boxes, I want to have them press cmdFindRecords and have these records show up.

I've tried using the standard access queries, but to no avail, due to the number of paramters.

I've notices you can build an action query using "DoCmd.RunSQL" - but it doesn't seem to let you just run a plain Select query.

I just want to generate an SQL statement, substitute the selctions the user made with variables into the SQL statement, and then print the recordset to the screen.

Can I/How do I do this? - Also I'd eventually like to format these records into a report rather than in just a plain recordset - but maybe that's a separate issue.

Seek not outside yourself; heaven is within.
 
thanks Tonster - have never run into the Choose Function before.

SC Q: Why is my computer doing that?
A: Random Perversity of Inanimate
Objects
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top