I'm not sure what Forms![Menu]![Workgroup] is supposed to be in conjunction
with opening reports, but try something like:
Function OpenProjectRpt()
Select Case CurrentUser
Case "ms1234"
DoCmd.OpenReport "DailyProjectActivity", , ,
"Forms![Menu]![Workgroup] IN ('1', '2', '3')"
Case "at1234"
DoCmd.OpenReport "DailyProjectActivity", , ,
"Forms![Menu]![Workgroup] = '4'"
Case "ms9876"
DoCmd.OpenReport "DailyProjectActivity", , ,
"Forms![Menu]![Workgroup] IN ('1', '4')"
Case Else
MsgBox "Restricted Database! Please verify Username and Password."
End Select
End Function
Note that I've changed the double quotes to single quotes in the WHERE
clauses. If Forms![Menu]![Workgroup] is numeric, not text, lose the single
quotes.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Mary" <(E-Mail Removed)> wrote in message
news:4FA5D6C7-8839-4E0A-B817-(E-Mail Removed)...
> Hello, I have a command button on a form that opens a report in print
> preview. This is an Access 97 secured db. I would like to use one
> button,
> but have it include records based on the current user. For example, if
> user
> ms1234 clicks the button, I would like data for Workgroups 1, 2 and 3. If
> user dc9999 clicks the button, just display data for Workgroup 4. I think
> it
> will look something like this, but need your help. Thanks! Mary
>
> Function OpenProjectRpt()
> Select Case CurrentUser
> Case "ms1234"
> DoCmd.OpenReport "DailyProjectActivity"
> WHERE Forms![Menu]![Workgroup] = "1" or "2" or "3"
> Case "at1234"
> DoCmd.OpenReport "DailyProjectActivity"
> WHERE Forms![Menu]![Workgroup] = "4"
> Case "ms9876"
> DoCmd.OpenReport "DailyProjectActivity"
> WHERE Forms![Menu]![Workgroup] = "1" or "4"
> Case Else
> MsgBox "Restricted Database! Please verify Username and Password."
> End Select
> End Function
>