daved2424
07-23-2001, 10:24 AM
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?
|
View Full Version : Editing Query Criteria From a Form daved2424 07-23-2001, 10:24 AM 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? Carol 07-23-2001, 06:17 PM 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. daved2424 07-24-2001, 03:51 AM 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. Carol 07-24-2001, 11:02 AM What is the criteria that you are asking for. daved2424 07-24-2001, 12:53 PM Like "" Carol 07-24-2001, 03:56 PM 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. daved2424 07-25-2001, 01:25 AM Yes, I am inputting one value, but has many matches and I want all these to be listed in a form. Carol 07-25-2001, 04:26 AM 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. daved2424 07-25-2001, 09:07 AM Thank you very much Access 2000 |