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

Specifying a Runtime Query

Status
Not open for further replies.

BellKev

Technical User
Jan 14, 2004
36
CA
Hello,

If I wanted to search a date field in my database but ask the user to specify the month at runtime, how would I do that?
 
Hi

At its most basic, make your query in the query builder, put a column X:Month([YourDateColumnNameHere), in the criteria of that coulmn, put [Enter Month]

You can more user friendly things, like have a form to prompt for the monh, even a combo box to give the choice 1 thru 12, but as I say at its most basic the above will work, note it assumes number value of date (ie 1-12, not Jan, feb etc)

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
HI Ken,

Thanks for the reply. To sound like a complete noob ... the second "user friendly" option you mentioned it was intrests me. For the life of me I can't figure out how to get the pull down menu for the user.
 
Hi

Create a form

Ensure the toolbox is visible and that the wizard is selected

click on the combo box tool and paste it onto your form, follow the wizard instructions for "I will enter the choices myself", select two columns, and enter 01 Jan 02 Feb ...etc

this will give you a combo box which drops down a list of months

Note this could also be done from a table, which is teh way I would normally popukate combos, but once you have learned how to use them, that part is straightforward

Once you have your form and combo box, you change the query criteria to

Forms!MyFormName!MyComboName

You need to replace the My.. bits with the appropriate names of your objects

The form must be open when you run the query

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top