I have a form that I use for entering data on sales of an item. On that form I have two fields, "CreatedDate" and "ChangedDate" which are locked and set by the following code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me!ChangedDate = Now()
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!CreatedDate = Now()
End Sub
The problem is that, when the main user of this form begins inputing data on a new day, this code doesn't properly set the CreatedDate for the first few records. The ChangedDate field is properly set. The problem corrects itself after a few records (anywhere from 2 to 8, so far).
I thought that somehow, an incorrect date might be stored in memory, so I tweaked the CreatedDate code as follows:
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim DateTime As Date
DateTime = Now()
Me.CreatedDate = DateTime
End Sub
but the problem still persists.
Can anyone help me out here?
Thanks for your ideas!
Don
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me!ChangedDate = Now()
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!CreatedDate = Now()
End Sub
The problem is that, when the main user of this form begins inputing data on a new day, this code doesn't properly set the CreatedDate for the first few records. The ChangedDate field is properly set. The problem corrects itself after a few records (anywhere from 2 to 8, so far).
I thought that somehow, an incorrect date might be stored in memory, so I tweaked the CreatedDate code as follows:
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim DateTime As Date
DateTime = Now()
Me.CreatedDate = DateTime
End Sub
but the problem still persists.
Can anyone help me out here?
Thanks for your ideas!
Don