Please help with IF statement

KenHigg - it worked.... MSAccessRookie, now I get what you were saying... Thanks guys I have learn several new things. Don't "_" after Then and then you can you put an End If at the end of the statement.....

As always this forum has great people and they are always willing to help....
 
cool - That 'don't equal or' stuff is a mind twister - :p
 
Don't feel too bad about it, about half the time I get the And and the Or mixed up myself. My example was poor because it was inclusive while yours was exclusive. We can all Learn from each other out here. Just glad to be a part of the solution.
 
Now I have the issue when the user is not in the list that it throws the MsgBox but will not undo the record and setfocus on the specific field.

Code:
If (Me.CompCode = "KM") And ((CurrentUser() <> "cmoratz1") And (CurrentUser() <> "bhoward") And (CurrentUser() <> "kwilliams") And (CurrentUser() <> "bwilliams")) Then
[COLOR="Blue"]MsgBox "You are not authorized to enter this claim. Please take it to MCRATS."[/COLOR]
[COLOR="Red"]UndoRecord_Click[/COLOR]
[COLOR="Red"]Me.tblClaims_SSN.SetFocus[/COLOR]
End If
 
Back to the dlookup thing:
( I actually use a dcount() )
 

Attachments

I am still having problems with the last statement.

Code:
If (Me.CompCode = "KM") And ((CurrentUser() <> "cmoratz1") And (CurrentUser() <> "bhoward") And (CurrentUser() <> "kwilliams") And (CurrentUser() <> "bwilliams")) Then
MsgBox "You are not authorized to enter this claim. Please take it to MCRATS."
UndoRecord_Click
[B][COLOR="Red"]Me.tblClaims_SSN.SetFocus[/COLOR][/B]
End If

Can Someone please tell me why it will not set the cursor back into this field?
 
FIgured it out. Just had to use the GotFocus on the next field.

Code:
Private Sub ClaimType_GotFocus()

If IsNull(Me.tblClaims_SSN) Then
Me.tblClaims_SSN.SetFocus
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom