IF & AND statement not working (1 Viewer)

ian_ok

Registered User.
Local time
Today, 21:53
Joined
May 1, 2001
Messages
90
IF & AND statement not working *SOLVED*

I'm trying to get a IF & AND statement working together but cannot get it to work when a field is null only. It works when testing has certain data in it, but I want it to work when the date field is empty (null)

Working Code if 10/10/2010 is entered
Code:
If Me.Breakage_Deposit > 0 And Nz(Me.Deposit_Payment_Date_Limit, "10/10/2010") Then

MsgBox ("deposit error")
        Response = acDataErrContinue

But when I change the above section to Me.Deposit_Payment_Date_Limit, IsNull

It doesn't work or compile correctly, where am I going wrong????

Ian

OK I got it working by doing this:​
If Me.Breakage_Deposit > 0 And IsNull(Me.Deposit_Payment_Date_Limit) Then

MsgBox ("deposit error")
Response = acDataErrContinue
 
Last edited:

John Big Booty

AWF VIP
Local time
Tomorrow, 06:53
Joined
Aug 29, 2005
Messages
8,262
The AND portion of your argument;
Code:
Nz(Me.Deposit_Payment_Date_Limit, "10/10/2010")
Isn't actually checking anything. It will either return the value held in Me.Deposit_Payment_Date_Limit or 10/10/2010 if Me.Deposit_Payment_Date_Limit holds a Null value, but you aren't checking it against anything :confused:
 

Users who are viewing this thread

Top Bottom