Saving Queries with a parameter form.

Monday, March 22, 2010

Saving Queries with a parameter form.Did you ever wish you could store a query that would pop a form when it starts to get your input of the search parameters?  You can.

The trick is the keyword ASK.

Lets' start by thinking about a simple query for people added to the database on a specific day -

SELECT lfname id email FROM person WHERE padddate="02/01/2010"

You'd like to store this so that it asks the user what date to select on before running. Try this:

 SELECT lfname id email FROM person WHERE padddate="ASK(Date Added,Enter the date and hit enter)"

The first text (Date Added) is the label for the parameter, the second is the help text that appears in the status bar.

Note that the entire ASK() expression is enclosed in quotes.

Give this a try - you'll see a dialog box like this pop up when you go to run it.

This example has just a single parameter, the add date. If you use ASK several times in the same query, you will get a start-up dialog allowing you to enter all your search parameters at once. Try it!

Tip Category Query
Get this widget!

Powered by Orchid Suites
Orchid ver. 4.7.6.