| | |
query with combo box input
Please support our MS Access and FileMaker Pro advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
hi every1
i m creating a simple ms access project.
i created a report ,when the user opens it,it opens a query which askes user to enter name.
the user enters the name and the report by that name generates.
is there a possibility that when the name is asked instead of a text box a combo box appears and it has pre entered names,from which user can choose and doesn't have to enter.
plz help as i hv to submit this project today.
and is there any option through which i can put a password on my access project
thanks in advance
i m creating a simple ms access project.
i created a report ,when the user opens it,it opens a query which askes user to enter name.
the user enters the name and the report by that name generates.
is there a possibility that when the name is asked instead of a text box a combo box appears and it has pre entered names,from which user can choose and doesn't have to enter.
plz help as i hv to submit this project today.
and is there any option through which i can put a password on my access project
thanks in advance
Last edited by bhuvan83; Mar 23rd, 2007 at 2:35 am.
Bhuvan Aggarwal
There is no word impossible.
its i m possible
There is no word impossible.
its i m possible
•
•
Join Date: Mar 2006
Posts: 57
Reputation:
Solved Threads: 3
Hi Bhuvan,
Here is a little jump-start for your parameter combo-box. It is from the book, Fixing Access Annoyances. You'd better work fast though, if your assignment is already 2 days late. Have fun.
"...use form data as parameters for queries.
First, create an unbound form and add the controls that you'll need for user input. Use text boxes for free-form data entry, combo and list boxes to constrain users to predefined values, and any other controls you need. All the usual "good design" practices apply, so use format and validation rules where appropriate to help your users submit valid parameters. Don't forget to add a "Run query" button.
Once the form is complete, you can reference its data in your query by placing fully qualified control names such as Forms!frmMyParamForm!txtMyParamField on the Criteria line of your query. ("Fully qualified" simply means using the whole path, not just the short name; in this example, txtMy-ParamField is the short name.) Here, frmMyParamForm is the name of your unbound form, and txtMyParamField is the name of a field on that form. For example, to use a date range as a query criterion, you'd enter something like Between Forms!frmMyParamForm!txtStartDate And Forms!frmMyParamForm!txtEndDate on the Criteria line of your query. When the user hits the "Run query" button, the query will pull those values (namely, the start and end dates she's entered in the form) from the data entry form. If your data entry form uses a combo box rather than a text box, you can use its value, like this: Forms!frmMyParamForm!cboMyComboBox. The usual rules about declaring parameter data types apply here.
In order for this to work, the form must be open, with the date range already entered, when the query is run. (If it isn't, Access won't be able to resolve the control names and will resort to the "Enter Parameter Value" prompt. You don't want that.) The simplest way to ensure this is to put the "Run query" button on the form itself. You can use the Command Button Wizard to do this. Once the wizard starts, choose the Run Query action in the Miscellaneous category on its first page."
Here is a little jump-start for your parameter combo-box. It is from the book, Fixing Access Annoyances. You'd better work fast though, if your assignment is already 2 days late. Have fun.
"...use form data as parameters for queries.
First, create an unbound form and add the controls that you'll need for user input. Use text boxes for free-form data entry, combo and list boxes to constrain users to predefined values, and any other controls you need. All the usual "good design" practices apply, so use format and validation rules where appropriate to help your users submit valid parameters. Don't forget to add a "Run query" button.
Once the form is complete, you can reference its data in your query by placing fully qualified control names such as Forms!frmMyParamForm!txtMyParamField on the Criteria line of your query. ("Fully qualified" simply means using the whole path, not just the short name; in this example, txtMy-ParamField is the short name.) Here, frmMyParamForm is the name of your unbound form, and txtMyParamField is the name of a field on that form. For example, to use a date range as a query criterion, you'd enter something like Between Forms!frmMyParamForm!txtStartDate And Forms!frmMyParamForm!txtEndDate on the Criteria line of your query. When the user hits the "Run query" button, the query will pull those values (namely, the start and end dates she's entered in the form) from the data entry form. If your data entry form uses a combo box rather than a text box, you can use its value, like this: Forms!frmMyParamForm!cboMyComboBox. The usual rules about declaring parameter data types apply here.
In order for this to work, the form must be open, with the date range already entered, when the query is run. (If it isn't, Access won't be able to resolve the control names and will resort to the "Enter Parameter Value" prompt. You don't want that.) The simplest way to ensure this is to put the "Run query" button on the form itself. You can use the Command Button Wizard to do this. Once the wizard starts, choose the Run Query action in the Miscellaneous category on its first page."
![]() |
Similar Threads
- Combo box and Ms-access (JSP)
- VBA Combo Box Problem (Visual Basic 4 / 5 / 6)
- cdo using combo box in my form (ASP)
- combo box (PHP)
- combo box (ASP)
- How do I limit text char in Combo box? (VB.NET)
- combo box help (VB.NET)
Other Threads in the MS Access and FileMaker Pro Forum
- Previous Thread: Querying a Calculated Field?
- Next Thread: MS Access password
| Thread Tools | Search this Thread |





