|
-
Dec 11th, 2009, 05:12 AM
#1
Thread Starter
Addicted Member
How to check if date is null
hi 
this is my code, and its not working,the way it should be
Code:
Code:
if rs!start_ded=0 then
exit sub
else
rs!start_ded=format(now,"mm/dd/yyyy")
what i want is to check if the rs!start_ded empty then do nothing else format(now,"mm/dd/yyyy"). i don't know what to put in if rs!start_ded=0
thanks!
-
Dec 11th, 2009, 05:36 AM
#2
Re: How to check if date is null
pick a record you know has an empty date and return the field to a messagebox or something
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Dec 11th, 2009, 06:03 AM
#3
Hyperactive Member
Re: How to check if date is null
yes as westconn1 told you return a record from your database and check it's value when date is empty to know what is it's format...Once done, you can compare it easily
For example in vb if you declare a date variable and you want to check if it's empty or not, you can do something like
vb Code:
if MyDate = "00:00:00" then
msgbox "Empty Date"
Else
msgbox "Not Empty"
End if
In your case you'd better check what are the values of empty dates in your database and then you make comparaison
-
Dec 11th, 2009, 06:28 AM
#4
Re: How to check if date is null
Code:
if IsNull(rs!start_ded) then
-
Dec 11th, 2009, 08:15 AM
#5
Re: How to check if date is null
Or
vb Code:
If Not IsNull(rs!start_ded) Then
rs!start_ded=format(now,"mm/dd/yyyy")
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|