Access 2000 Date Function - TechRepublic
General discussion
September 22, 2005 at 09:16 AM
mra2

Access 2000 Date Function

by mra2 . Updated 20 years, 9 months ago

All I wanted to do on a FORM was:

If the date is null (Not entered) then enter the System Date.

Here is ny code which for some reason WILL NOT recognize the Date Function…

Private Sub Command12_Click()
On Error GoTo Err_Command12_Click

? THIS SECTION DOES NOT WORK
If IsNull([Forms]![Form1]![Dates subform]![DateServ]) Then
‘[Forms]![Form1]![Dates subform]![DateServ] = #1/1/2222# ?This Works!
[Forms]![Form1]![Dates subform]![DateServ] = Date ‘ Does not recognize Date Function

End If

‘Prevent Orphan (Non-Viewable)Record
? This section works
If IsNull([Forms]![Form1]![Notes Subform1]![Notes]) Then
[Forms]![Form1]![Notes Subform1]![Notes].Value = “None”
‘[Forms]![Form1]![Notes Subform1]![Notes].Value = Null ‘ This works
End If

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox “NEW Record Saved!”

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub

Can anyone explain why this does NOT work and how I can do this….

Thanks,
A2

This discussion is locked

All Comments