Error in Simple IIF Satament, What's Wrong with this code ?

  • Thread starter Thread starter Dave Elliott
  • Start date Start date
D

Dave Elliott

If Not IsNull(Customer_ID) Then

MsgBox "Need Customer Please"
Cancel = True
Me.Customer_ID.SetFocus
End If
If IsNull(Me.Combo6) Then
MsgBox "SalesPerson Needed Please"
Cancel = True
Me.Combo6.SetFocus
End If


Thanks in Advance,

Dave
P.S. I have a macro used to check for Customer Duplicates, not working.
This macro is set to run on Before Update.
DLookUp("[Customer ID]","[Customers]","[Customer ID] = Form.[Customer ID] ")
Is Not Null
 
Dave,
If Not IsNull(Customer_ID) Then

If IsNull(Customer_ID) Then

But you should use:

If Nz(Customer_ID,"")="" Then

because there's a difference between Null and "" ;-)

HTH - Peter
 
Back
Top