trouble with updating date field

Gregvg

Registered User.
Local time
Today, 09:17
Joined
Dec 23, 2009
Messages
18
as a first time poster to this board i hope that i can get an answer to what is probably a very simple problem. i have the following code that isn't updating the field. it's suposed to look at the date field and if it is null then enter the date. if the date is already there then go to the next step which it is doing. it's not changing the existing date which is good, but it's not puting one in when it is missing either. if i take out the if statement the date goes in the field properly. any help will be greatly apreiciated.
Code:
Private Sub Command53_Click()
If Me.[Date Issued] = 0 Then
Me.[Date_Issued] = Now()
Else
Call Emailreport
DoCmd.Close acForm, "Work Order", acSaveNo
Forms![Dashboard].Refresh
   End If
End Sub
 
You're not testing for Null, you're testing for zero. Try

If IsNull(Me.[Date Issued]) Then
 
try
Code:
Private Sub Command53_Click()
If len(Me.[Date Issued]) = 0 Then
Me.[Date_Issued] = Now()
Else
Call Emailreport
DoCmd.Close acForm, "Work Order", acSaveNo
Forms![Dashboard].Refresh
 End If
End Sub
Or
Code:
Private Sub Command53_Click()
If isnull(Me.[Date Issued]) Then
Me.[Date_Issued] = Now()
Else
Call Emailreport
DoCmd.Close acForm, "Work Order", acSaveNo
Forms![Dashboard].Refresh
 End If
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom