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

After update

Status
Not open for further replies.

ytakbob

Programmer
Jul 20, 2000
105
US
Using form level after udpate event to update a hidden field on a form.
THis poses a problem in that it creates an infinite loop.

field userid gets updated when any other field is updated which updates userid which forces after update to get executed again because after update updated userid which caused after udpate to execute again.....and on and on...

Is there a better way to solve this than putting the userid update on every field's after update event on the form ?

Bob Schmid
bob_schmid@hmis.org
330-746-1010 ext. 1347
 
Hi Bob!

Why not use the BeforeUpdate event for the form. That should alleviate the problem. If that doesn't work then you could use this code:

Dim cntl As Control

For Each cntl In Me.Controls
If cntl.ControlType = acTextBox Or cntl.ControlType = acComboBox etc.
If cntl.Name <> &quot;YourHiddenControl&quot; Then
If cntl.OldValue <> cntl.Value Then
Update hidden control
Exit For
End If
End If
End If
Next cntl

This will only update the hidden control if some other control has been changed.

hth Jeff Bridgham
bridgham@purdue.edu
 
Thanks Jeff !
before udpate Bob Schmid
bob_schmid@hmis.org
330-746-1010 ext. 1347
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top