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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can you tell if a date field is null? 1

Status
Not open for further replies.

tziviak

Technical User
Oct 10, 2002
128
US
I have a date field-set to shortdate and in my code I'm trying to test it if it's null-in an if statement-but the problem is that it never tests as null (although the field is empty) -it always executes the else part of the statment.
is there another word to use instead of null-since it's a date field?
my code is:

If rec.Fields("DateReceived") = Null Then
MsgBox "deleted"
rec.Delete
Else
MsgBox "date received" & rec.Fields("DateReceived").value
End If


thank you
 
If IsNull(rec.Fields("DateReceived")) Then
MsgBox "deleted"
rec.Delete
Else
MsgBox "date received" & rec.Fields("DateReceived").value
End If

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top