svensonpiep
Technical User
Please take a look at the following codes:
Private Sub date1_BeforeUpdate(Cancel As Integer)
If [date1] <> "" Then
[date2] = DateAdd("d", 15, date1)
Else: [date2] = Null
End If
End Sub
what I am trying to accomplish seems very simple.
If date1 is null or empty, then leave date2 blank as well.
Now, assume that date1 is blank, it leaves date2 blank.
This part works fine from the code above.
But if date1 has a date value, then add 15 days to it and show the new date in date2.
What is really annoying me is if date1 has a date let's say,
02/01/2002, the only way it adds 15 days is if you click perform some operations on date1.
If date1 is 02/01/2002 and you remove the 01 and put it back, or you remove 01 and replace it with another number, the date updates fine in date2.
What I really want is to see 15 days added to date1 and updated in date2 if date1 is not null.
I have used Before_update, after_update, onclick, on enter.
Nothing is working.
I hope I am clear in my explanation. I need help!!
Private Sub date1_BeforeUpdate(Cancel As Integer)
If [date1] <> "" Then
[date2] = DateAdd("d", 15, date1)
Else: [date2] = Null
End If
End Sub
what I am trying to accomplish seems very simple.
If date1 is null or empty, then leave date2 blank as well.
Now, assume that date1 is blank, it leaves date2 blank.
This part works fine from the code above.
But if date1 has a date value, then add 15 days to it and show the new date in date2.
What is really annoying me is if date1 has a date let's say,
02/01/2002, the only way it adds 15 days is if you click perform some operations on date1.
If date1 is 02/01/2002 and you remove the 01 and put it back, or you remove 01 and replace it with another number, the date updates fine in date2.
What I really want is to see 15 days added to date1 and updated in date2 if date1 is not null.
I have used Before_update, after_update, onclick, on enter.
Nothing is working.
I hope I am clear in my explanation. I need help!!