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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check what field on the form has been changed

Status
Not open for further replies.

sabavno

Programmer
Jul 25, 2002
381
CA
On save_click event I want to check what fields have changed. I know I can check it the form has been changed by going IF ME.DIRTY....but what about every specific field?
 
Dirty can only apply to a form. You would have to put code in every control to check for input and keep a note in variables of which fields have been changed. Have fun! :eek:)

Alex Middleton
 
Hi!

As long as the record has not been saved then for each control you can compare the value to the oldvalue:

Dim cntl As Control

For Each cntl In Me.Controls
If cntl.ControlType = acTextBox Or etc(control types to check Then
If cntl.Value <> cntl.OldValue Then
Do your stuff here
End If
End If
Next cntl

hth

Jeff Bridgham
bridgham@purdue.edu
 
aA bit easier to check if the control has a control source and that it (control source) is not blank that to enumerate the type of controls. Just incl on err resume next in the loop ... this just picke out the BOUND controls, which is what you really want. Of course is you are using the unbound control approach, you already have the list of controls which you map to the db, so the above isn't applicable at all.



MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top