Solved

Access - On Open Event Procedure - Report

Posted on 2006-07-17
2
636 Views
Last Modified: 2008-03-10
I have this:
Private Sub Report_Activate()

'If CurrentUser <> "ns" Then
 '   Report.RecordSource = "qryWorksForUsername"
  '  End If
    If CurrentUser <> "ou" Then
       Report.RecordSource = "qryWorksForUsername"
    End If
   ' If CurrentUser <> "wa" Then
    '   Report.RecordSource = "qryWorksForUsername"
    'End If

End Sub

I didn't write this but now I need to modify it so that it affects more than one user as it only does now.

So I would like to make this statement

  If CurrentUser <> "ou" Then
       Report.RecordSource = "qryWorksForUsername"

effective for user ou, wa and ns all at once.  I would think there is a way to do this.
0
Comment
Question by:lawson2305
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 17123680
Try this ...

If CurrentUser <> "ou"  OR CurrentUser <> "wa"  OR CurrentUser <> "ns" Then
       Report.RecordSource = "qryWorksForUsername"
End If

ET
0
 
LVL 19

Accepted Solution

by:
Eric Sherman earned 250 total points
ID: 17123701
Actually you should use AND in place of OR, my mistake.

If CurrentUser <> "ou"  AND CurrentUser <> "wa"  AND CurrentUser <> "ns" Then
       Report.RecordSource = "qryWorksForUsername"
End If


ET
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question