On Load / On Current Event Question (1 Viewer)

NearImpossible

Registered User.
Local time
Today, 07:04
Joined
Jul 12, 2019
Messages
225
I have several fields on my form that I want to ensure are locked every time a new record is selected, so the data can't accidentally be changed. I have code set in the On Current event to handle this. These fields can be unlocked/locked via a button to edit the field if necessary, so I am forcing them to be locked on a record change, in the event the user fails to re-lock them after editing.

My question is I am also calling this same code during the On Load event, so I can ensure the fields are locked when the form is launched

Is this causing the code to run twice when the form is launched, or does the On Current event not fire until after I select a new record after opening the form?
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 05:04
Joined
Oct 29, 2018
Messages
21,467
Hi. Yes, you are firing the code twice since the Current event is the last event that fires when you open a Form. To test this, you can add a MsgBox in your code and watch how many times it shows up.
 

Users who are viewing this thread

Top Bottom