Solved

Access - On Open Event Procedure - Report

Posted on 2006-07-17
2
594 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
  • 2
2 Comments
 
LVL 19

Expert Comment

by:Eric Sherman
Comment Utility
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
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now