Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AND command/statement

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
Hello all, just a quick question. How would one use an AND statement with an IF statement in VBA?

Currently I have code to look at a table and see if there is a record in it, if there is then a msgbox gets sent to all users. I would like to add functionality to send to individual people so how could I add an AND to the IF statement to say if the table is not null AND the employee_number matches then send the message? Below is what i am using today...i hope this all made sense.

Code:
If Not IsNull(DLookup("[message]", "tblmessage")) Then
MsgBox DLookup("[message]", "tblmessage"), vbInformation

Thanks for any help!

Paul
 
How about:

Code:
Dim s As String

s = DLookup("[message]", "tblmessage") & ""

If (s <> "") And (employee_number matches) Then
    MsgBox s, vbInformation 
End If

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top