event when record changes

crosmill

Registered User.
Local time
Today, 20:20
Joined
Sep 20, 2001
Messages
285
I'm new to this and I have this code.

Private Sub ejay_Mixing_Station_Change()
If ejay_Mixing_Station > 10 Then
Me![Label13].Visible = True
Else
Me![Label13].Visible = False
End If
End Sub

Which works and makes text apear if the quantity is over 10.

the problem is that i need the code to run when I'm scrolling throught the reords. At the moment it only runs when the quantity in the text box is changed. I've tried using the on change event and setting it to the ID, but that doesn't work either.

[This message has been edited by crosmill (edited 10-18-2001).]
 
The code looks fine to me... just place it in the "OnCurrent" event of your form instead of the change & it will runn every time you navigate to a new record.
If I'm not mistaken, the change event only fires when a control or record is modified. OnCurrent runs when the focus moves to a new record, regardless of whether or not the information in the record is different. I've used OnCurrent before and it works fine though.
 
You Sir are an utter star.

Thanks alot
 
Well you could save having to add the code to the change event by just using Form_Current.
 
I prefer to keep the number of modules to a minimum whenever possible Pat. Putting the code in the current event and the putting Form_Current in the event procedures of any relevant text boxes forces Access to run the procedure contained in the form current module irrespective of the actual status of the record. It's a technique I use many times to prevent duplication of calculation vba procedures.
 
mmmmmmmmmmmm, some points I hadn't considered.

thanks for the lesson.
 
I would use the After Update event instead of the On Change event. The later will fire every time a character is type in. I then would simply "Call" the sub in the On Current event of the form instead of typing the code in both event procedures.

RDH
 

Users who are viewing this thread

Back
Top Bottom