Josué said:
Hi, i have searched the forum for one answer but haven't found it so
here's
my question.
Is it possible to count the number of times that a date field in a form is
changed? how do I do it?
TIA
Do you want to record only a single total, the number of times the field was
changed for any and all records, or do you want to record separately the
number of times the field was changed for each record?
To record only a single total, you could do something like this ...
Private Sub txtTest_AfterUpdate()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("SELECT TestNum FROM tblTest")
With rst
If (.BOF And .EOF) Then
.AddNew
Else
.Edit
End If
.Fields("TestNum") = Nz(.Fields("TestNum"), 0) + 1
.Update
.Close
End With
End Sub
.... where "txtTest" is the name of the textbox, "TestNum" is the name of the
field in which you want to record the total, and "tblTest" is the name of
the table containing that field.