I'm a very new user and I'm trying to teach myself Access.
I've offered to create a database for a non-profit preschool. I'm trying to
create a report in which the user will be asked which teacher they want the
report for. I have the table and report created. I just don't know how to get
the report to ask the user which teacher the report is for?
Thanks,
Mary
While you can have query prompt for you to enter a Teacher name, this
leaves you open to possible miss-spelling the name.
A better, more professional method would be to select the teacher from
a combo box drop-down.
Have you learned how to create a query yet?
Have you learned how to create a Form and/or a Combo Box yet?
Have you learned how to write code in an event procedure?
Now's a good time to learn. If you need help on any of these steps,.
post back and I'll go into more detail.
You'll need to use a form to do this.
First, create a query that will display the fields you wish to show in
the report. Include the TeacherID and TeacherName fields.
Second, create a report, using the query as it's record source, that
shows the data you wish to display for ALL teachers.
Let's assume it is the TeacherID number you need as criteria.
Next, make a new unbound form.
Add a combo box that will show the TeacherID field as well as the
Teacher Name field (you can use the Combo Box wizard to do so).
Set the Combo box's Column Count property to 2.
Hide the TeacherID field by setting the Combo box's ColumnWidth
property to 0";1"
Make sure the Combo Box Bound Column is the
TeacherID field.
Name this Combo Box "cboFindName".
Add a command button to the form.
Code the button's Click event:
Me.Visible = False
Name this form "ParamForm"
Go back to the query. As criteria, on the Query's TeacherID field
criteria line write:
forms!ParamForm!cboFindName
Code the Report's Open Event:
DoCmd.OpenForm "ParamForm" , , , , , acDialog
Code the Report's Close event:
DoCmd.Close acForm, "ParamForm"
Run the Report.
The report will open the form.
Find the teacher's name in the combo box.
Click the command button.
The Report will display just the records for the teacher selected.
When the Report closes it will close the form.