Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flagging updated records

Status
Not open for further replies.

johnster

Programmer
Joined
Jan 3, 2001
Messages
9
Location
GB
I have a database where i want a date stamp recorded when certain fields are changed/altered. the 'Me.dirty' function is no good for me as it picks up changes on the whole form. is there a way for a record to be date stamped automatically when only certain fields have been altered/are 'dirty'.

Thanks in advance.

John
 
Create Date/Time type field in the table e.g. field RevisionDate for registration of updates. Include this field in form (maybe invisible).

Event Form_BeforeUpdate:
private sub Form_BeforeUpdate(Cancel as integer)
me.RevisionDate = now()
end sub

Now all changes of record will be registered (12-5-2001 10:30:43).

Aivars


 
Cheers Aivars, it's one solution but it's not ideal for what i require. i really wanted it to insert a date after the user is prompted, before the form is updated rather than each seperate control. An example of what i was trying to do, though which didn't work (as The Dirty function doesn't seem to be supported on controls), is below;
_____________________________________________________
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim A As Integer

If Me![Text581].Dirty Or Me![Text119].Dirty _
& Or Me![Text123].Dirty Or Me![Text124].Dirty _
& Or Me![Text125].Dirty & Me![Text126].Dirty _
& Or Me![Text135].Dirty Or Me![Text127].Dirty _
& Or Me![telnumber].Dirty Or Me![Text129].Dirty Then

A = MsgBox("Has the current record been altered?", vbYesNo)

If A = 6 Then
[Forms]![main]![Details_Updated_Date] = Date
Else
Exit Sub
End If
End If

End Sub
_______________________________________________________
Sorry if i wasn't too clear before. Thanks again in advance.

John
 
John

How about using the OldValue property to determine whether particular fields have been changed?
e.g.
If text1.value <> text1.oldvalue or text2.value <> text2.oldvalue (etc...) then

Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top