prob with date and if-procedure

Highnz

Registered User.
Local time
Today, 08:16
Joined
Aug 23, 2005
Messages
16
hi there
ive got a little problem with VBA
i have a command button and a text field in my form
with the button i want to write the current date in the text field
but if the field is not empty the button should do nothing

here is my current code:

Private Sub Button_Insert_Date_Click()
Dim Date1 As Date
If Forms![F_Auftagsdaten]![Erlaedigt_am] = "" Then
Forms![F_Auftagsdaten]![Erlaedigt_am] = Date1(Date)
End If
End Sub

i hope i wrote my problem understandly for you
thanks
 
somebody else helped my
it has to look like this:

Private Sub Button_Insert_Date_Click()
If IsNull(Me![erlaedigt_am]) Then
Me![erlaedigt_am] = Date
End If
End Sub
 
What if the started to key a date then removed [deleted] it? You need to also test for an empty string...

If IsNull([erlaedigt_am]) or [erlaedigt_am] = "" Then
 

Users who are viewing this thread

Back
Top Bottom