Editing Query Criteria From a Form

daved2424

Registered User.
Local time
Today, 17:03
Joined
Jun 28, 2001
Messages
20
I know it is possible to ask the user to define the criteria for a query from a form, but how do you do it?
 
There are 2 ways to achieve this.
The first and easiest is to prompt the user by using the Parameters within the actual Query. Open up your query and click on Query and then on Parameters. Input your criteria with the Data Type.

The 2nd is to make a custom dialog box that prompts the user for information, usually based upon unbound text boxes that would normally hold a From Date and To Date amongst other information. The user would then enter in the information and in the criteria for your query, you would specify the field names in the dialog box. Your query would return the records pertaining to the information requested by the user.

The 2nd way is by far the better way, as you can customize the form, asking for multiple information, complete with look-ups/combo boxes, whereas with using the parameters contained within the actual query you are limited by the standard message prompt.

If you need more help, then post again. A search on this forum under Custom Dialog Box would probably yeild some good information.
 
Thank you for your assitance.

I have now created a dialog box with a text box for the user to enter the criteria they wish to search for, but I am unsure as to which string to put in the criteria box, (I am not all that familiar with VBA). Please could you help. Also, is there anything else i need to do to make this work.
 
What is the criteria that you are asking for.
 
Are you trying to do a search? The reason I'm asking is using "Like" along with wildcards is usually reserved for performing specific searches for further editing, and validation in select queries and can involve some complex code especially if you are requesting from more than one field and different data types. Whereas with defining criteria from a custom dialog box is usually used to get records that would produce a report and in most instances, look-ups are used to narrow the request.
 
Yes, I am inputting one value, but has many matches and I want all these to be listed in a form.
 
What you are looking for is called Query by Form. I have made a small database with this set up as an example that I could e-mail you, which you could incorporate into your work. I need to know what version of Access you are using before I send it.
 

Users who are viewing this thread

Back
Top Bottom