Checking to see if a record has changed

I

Ian

I am trying to see whether the data in a record on a form has been changed by
a user. Any Ideas

I was trying to concatinate all the data from each field together into a
single string when you open the record, and compare this to the concatinated
string of all the data when you leave the record. I was trying to use the
following statement to concatinate the data...

DIM i AS String

FOR EACH TEXTBOX IN FORM

i = i & TEXTBOX.VALUE

NEXT

....But it didn't work - Any Suggestions will be appriciated. thanks
 
R

Roger Carlson

I would create an audit function that would record any change to the
database. Information included would be: the table, the field, the old
value, the new value, and the user.

On my website (www.rogersaccesslibrary.com) there is a small sample database
called: "AuditTrail.mdb" which should get you started.

--
--Roger Carlson
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
T

Tim Ferguson

I am trying to see whether the data in a record on a form has been
changed by a user. Any Ideas

If Me.Dirty Then
MsgBox "You've edited the data!!"

Else
MsgBox "What, you just looking or are you buying?"

End If



HTH


Tim F
 
G

George Nicholson

--
George Nicholson

Remove 'Junk' from return address.
Ian said:
I am trying to see whether the data in a record on a form has been changed
by
a user. Any Ideas

I was trying to concatinate all the data from each field together into a
single string when you open the record, and compare this to the
concatinated
string of all the data when you leave the record. I was trying to use the
following statement to concatinate the data...

DIM i AS String

FOR EACH TEXTBOX IN FORM

Try:
Dim strTemp as String
Dim ctl as Control

For Each ctl in Me.Controls
If ctl.ControlType = acTextBox then
strTemp = strTemp & ctl.VALUE
End If
Next ctl

("Me" refers to the form who's code module contains this code)
 
D

David C. Holley

Read up on the the onDirty event. The event triggers (if memory serves)
when any field value is changed - even down to a single letter.
 
T

Troy

If me.Dirty = True Then 'Form data has changed.

You need to check this in the BeforeUpdate even of the form and act on it
appropriately.

--
Troy

Troy Munford
Development Operations Manager
FMS, Inc.
www.fmsinc.com


I am trying to see whether the data in a record on a form has been changed
by
a user. Any Ideas

I was trying to concatinate all the data from each field together into a
single string when you open the record, and compare this to the concatinated
string of all the data when you leave the record. I was trying to use the
following statement to concatinate the data...

DIM i AS String

FOR EACH TEXTBOX IN FORM

i = i & TEXTBOX.VALUE

NEXT

....But it didn't work - Any Suggestions will be appriciated. thanks
 
Top