Field Specific Report (2nd post)

  • Thread starter Thread starter MB
  • Start date Start date
M

MB

Hello MVPs.

I have a query that includes EmployeeName, Department,
CourseDate, CourseName to which I am using for a report.

I would like a separate report for each department. I
have the report in a switchboard so the user can click a
button, but I would like a dialog box to ask for the
Department name, first. The report would then be for
just that department.

I'm still new to Access, so I hope I explained this
clearly. I am using Access 2002.

Thank you!


..
 
This is easy...

Open up the query that is the record source for the
report. In the dept column, enter the following [Enter
Dept Code]. Save the query.

Try running the report...you will be prompted to insert a
dept code and the report will filter accordingly.

John
 
MB said:
I have a query that includes EmployeeName, Department,
CourseDate, CourseName to which I am using for a report.

I would like a separate report for each department. I
have the report in a switchboard so the user can click a
button, but I would like a dialog box to ask for the
Department name, first. The report would then be for
just that department.

Since I think poping up a form just to enter a (possibly
invalid) department name is a clumsy user interface, I would
like to talk you out of using a dialog box. If you placed a
combo box on the same form with the button, then users would
be able to select an existing name (no chance of an error)
before clicking the button. In this arrangement, the
button's code might (depending on how the combo box is
setup) look like:

Dim strDoc As String
Dim strWhere As String
strDoc = "nameofreport"
strWhere = "[CompanyName] = """ & Me.thecombo & """"
DoCmd.OpenReport strDoc, acViewPreview,,strWhere
 
Back
Top