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

Form Afterupdate question 1

Status
Not open for further replies.

bmc1234

Programmer
Jul 21, 2005
50
US
I have code that I want to run every time a control on a form is updated. I'm looking for an easy way to do it where I can put it in one place rather than in the afterupdate methods of every control on the form. Is there one event that runs every time anything on a form is changed?

My goal is to have a label on the form that say "Saved" and goes away when something changes and is not saved.
 

Haven't tested this, but how about something like...
Code:
Private Sub Form_Current()
    If me.Dirty Then
        me.lblSaved.Visible = True
    Else
        me.lblSaved.Visible = False
    End If
End Sub



Randy
 
Hi!

There is an event call DataChange that you can use.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Randy700: I tried it in current() but it only calls when you change the record.

jebry: I tried it in datachange() but it looks like that is an event associated with pivot tables
 
Hi!

One thing I have done before is to create a public function that does what you want it to do and then, in the property sheets for each control in the afterupdate event put:

=YourFunction()

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
bmc
on form current it is never me.dirty.
what you should do is on form dirty event put
me.lblSaved.Visible = True
and on form current
me.lblSaved.Visible = True





 
sorry
Should be
me.lblSaved.Visible = False
and on form current
me.lblSaved.Visible = True
 
Thanks. Although in my particular situation it's not quite as simple as that, that's a great start. thanks.
 
I'd put this in the Current event procedure:
Me!lblSaved.Visible = (Not Me.NewRecord)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top