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!

Understanding event to lock records in subform 1

Status
Not open for further replies.

longestdrive

Programmer
Jan 23, 2007
26
GB
Hi

I have a main form with 2 connected subforms. When a user clicks in a record on subform1 the data in subform2 is updated using requery.

Historical records have a field called locked which is either true or false. Depending on the value of this field I want stop the user editing the record in subform2.

I was expecting to use the code ctlName.locked = true

I've tried to place the code in various places with limited success.

The problem I have is undertanding the events being triggered to ensure that each time the use clicks on the record in subform1, it evaluates the flag and locks or unlocks the controls in subform2.

I've tried ONLOAD in subform2 which only appears to fire the first time the form is loaded, not on each requery

I've tried ON CURRENT in subform1, after the code which requeries subform2. This appears to be firing at each click as expected but does not lock or unlock the controls in subform2.

To test the event is firing and the value of the flag I'm using a message box for now so I can test the evnt and the value.

Any suggestions of the best place and method to lock controls in a subform??

Thank you
 
I'd use the Current event procedure of subform2.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top