Run a query/report based on selection from list

KevinSlater

Registered User.
Local time
Today, 18:51
Joined
Aug 5, 2005
Messages
249
Dear all, is it possible to run a query (or ideally a report) based on a selection from a drop down list in a form? (in accsess 97). The reson being is i have a big list of of codes for different absence reasons & at present the user has to type in the correct code to display the data in a report based on the code they enter, however its not easy for users to remember which code to type in to run a report.

Idealy what i would like is a drop down list with the absence codes & the absence desciption next to each code, then when the user selects a code from the list it displays the corresponding data in the report?

Is this possible?, any help would be much appreciated, thanks.
 
No problem.

First you need a list of codes. Presumably you have this in a table somewhere. Use a query to extract the code and description. Use this query to create a combo box on your form. The combo wizard will help you do this.

Your report needs to be based on a query. Now you use the entry in the combo box as a criterion for your query. If your combo is called cboMyCombo and the form is frmMyForm, then the criterion in your query needs to be:
Forms!frmMyForm.cboMyCombo

Create a button on your form that runs the report. This will automatically run the query based on whatever is selected in the combo.
 
Thanks, drop down list to run report is working

Thank you very much neileg!, i played about a bit and its working fine now, seems so simple when you know how, thats made it much easier now, it saves the users time trying to remmber codes when they can now simple select from the drop down list & view the report.

Thanks again

Kevin :)
 
Hi,
I'm trying this but instead of a report, I'm trying to open another form.

I have my first form 'f_lastnamesearchform'that has a combo named 'cboMyCombo'

I've added a button to open my next form

On the query, I've added this to the criteria of my Employee name field that form #2 is based off.

[Forms]![f_lastnamesearchform].[cboMyCombo]

When I try and use the first form, it opens the second form with 0 results.

If I just go ahead and open the second form directly it prompt me with
a popup box that says
[Forms]![f_lastnamesearchform].[cboMyCombo]

If I manually enter the name, it brings up the info.

so it seems I have something not right in the first form. Any ideas?
 
[Forms]![f_lastnamesearchform].[cboMyCombo] will pick up the bound column in the combo. This may well not be the column that is displayed. If you have an ID field as the first column and the name as the second, but the ID is hidden, it's still the ID field that passes to the query. In this case you need to refer to the column you want. Remember that the column count starts at 0.
 

Users who are viewing this thread

Back
Top Bottom