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

Locking Subform

Status
Not open for further replies.

DoctorJDM

Technical User
Apr 15, 2007
60
0
0
GB
Have a form frmHospitals containing

- a set of controls including HospitalID
- a subform sfmRestrictions showing restrictions applying to the current hospital, as a single field in Datasheet view; linked by HospitalID
- a second subform sfmContracts also linked by HospitalID, containing a set of controls including ContractID, and an embedded subform sfmDepartmentsCoveredByContract linked to the current Contract via ContractID

I'd like to be able to prevent users changing records in any part of the form, but provide an unlock button for the administrator to do so.

I can lock the selection of fields on the main form using a splendid procedure provided by TheAceMan.

Similarly I can lock the first subform using
me.sfmRestrictions.Locked = True

Repeating this for sfmContracts doesn't work, and my attempts at syntax to get to the embedded subform have all failed.

Any suggestions?

 
In your example sfmRestrictions is the name of the sub form control not the name of the form object.

Look at the "Name" and "Source Object" properties of both subform controls and see if that helps.

It can be tricky to select just the control. I find that lasso-ing (selecting by drawing a box with the mouse) the subform control by starting in the main form and selecting over part of the control to be the easiest.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top