Selecting users from a form to print

C

Chris 1979

I made a form that is used similar to the switchboard. I need to be
able to print a report by two different ways. First by selecting from a
drop down list the person's name and printing a detail report of just
one employee or by checking a box and having the print all the
employees. I'm not where or how to begin when it comes to VBA coding.

My first time using a forum, not sure if someone would like me to email
them a copy of the database to look at or what. Let me know if you can
help.
 
J

Jeff L

The first way, you would need to set a condition when you open your
report
DoCmd.OpenReport "ReportName", acViewPreview, , "EmployeeID = " &
Me.EmployeeField

The second way, you just open your report
DoCmd.OpenReport "ReportName", acViewPreview

You'd set up your condition something like this:

If IsNull(Me.EmployeeField) then
DoCmd.OpenReport "ReportName", acViewPreview
Else
DoCmd.OpenReport "ReportName", acViewPreview, , "EmployeeID = " &
Me.EmployeeField
End If

You don't really need the checkbox.
 
Top