Using IF

canjfn

Registered User.
Local time
Today, 22:02
Joined
Apr 24, 2001
Messages
28
I have 5 users who raise documents and am trying to construct an if statement to put their user name on the report without them having to enter it manually, I am picking up their network login name using a function from here

If Me![LoginName] = "Fred" Then
Me.Text89 = "Jack"
Else
Me.Text89 = "Doc Control"
End If

The above works fine and puts the name jack in Text89 as shown
For the remaining users, this doesn't work and just puts doc control in text89

If Me![LoginName] = "Fred" Then
Me.Text89 = "Jack"

If Me![LoginName] = "Mike" Then
Me.Text89 = "Paul"

If Me![LoginName] = "Terry" Then
Me.Text89 = "John"

Else
Me.Text89 = "Doc Control"
End If

How do I nest the if's together or is it a case statement ?

Thankyou
 
This is how you use IF and ElseIf...

Code:
If Me.[LoginName] = "Fred" Then
     Me.Text89 = "Jack"
ElseIf Me.[LoginName] = "Mike" Then
     Me.Text89 = "Paul"
ElseIf Me.[LoginName] = "Terry" Then
     Me.Text89 = "John"
Else
     Me.Text89 = "Doc Control"
End If
Watch how and when you use the bang "!" instead of a "." for Me. instead of Me!
 
Thanks very much.
 

Users who are viewing this thread

Back
Top Bottom