ok then do this: this will always accomodate any changes in the supervisor names cause it will draw from your Supervisor table instead of hard-coding their names on your form. i know this looks kind of long but don't worry it's not hard.
put a list box on your form (from the tool box). name it lstSupChoice (list Supervisor Choice).
using the wizard, base it on your Supervisor table.
when it's done with the wizard, view your form in form design; you should have a list box containing the names in your Supervisor table. Look at the design view again-in the properties of the list box, go to MultiSelect and choose EXTENDED.
put a button on the form, called btnViewSupReport.
cancel the wizard when it comes up.
right-click on the button and choose Properties from the shortcut menu.
In the OnClick event, choose [Event Procedure] and click the button to the right which has three dots on it.
in the code window that pops up, paste this in there:
Code:
Dim strWhere
strWhere = ""
Dim intI As Integer
With Me!lstSupChoice
For intI = 0 To .ListCount - 1
If .Selected(intI) Then
If strWhere = "" Then
strWhere = "Supervisor = '" & .ItemData(intI) & "'"
Else
strWhere = strWhere & " or Supervisor = '" & .ItemData(intI) & "'"
End If
End If
Next intI
End With
DoCmd.OpenReport "SupReport", acViewPreview, , strWhere
you have to substitute the name of your report in the last line (OpenReport).
what this is doing is this:
a user can now select one or more supervisors from the list box by using the ctrl or shift keys. use ctrl + mouse click to choose two supervisors whose names are not next to each other; choose shift+click to choose a block of supervisors. play with it and you'll see what i mean.
after selecting one or more supervisors, user clicks the button. the code loops thru the list of supervisors, picks out who has been chosen, and concocts a 'where' string, so i.e. picking Tim and Mark will result in
"Supervisor = 'Tim' or Supervisor = 'Mark'"
then you use this 'where' clause when opening the report, so that only records for these are shown.
the only other thing you may have to tweak: if the 'supervisor' field in the table/query is not called 'Supervisor' then substitute whatever it is in the code above for the word 'Supervisor'.
you can look in any book or HELP re: List box, multiSelect or ItemsSelected Property.