Forms with 2 subforms

rexb

Registered User.
Local time
Today, 15:45
Joined
Oct 29, 2008
Messages
129
Hello,

Need help!

I have created a Form with 2 subforms I am using access internal commands for adding records and from going from 1 record to another. The main form and the 2 subforms are accessing different tables.

What I want is to have the data on the main form lock so that it doesn't get edited but I wan't to be able to add records if the user clicks the add button.

I tried setting "allow edition= no" but it would disable/not display the 2 subforms data. And when I try to click add on the main form it will also disable the 2 subforms.

I've attached the database. Please somebody help I am new to access.

Thank you very much
 

Attachments

Last edited:
I got lost trying to follow the ins and outs of your post, probably my fault, but what you have to understand is this:

In a form/subform scenario, you can do nothing with

AllowAdditions/AllowEdits/AllowDeletes

by changing their values in the subforms! A subform is, in actuality, no longer a form, but rather a control on the main form, and thus is ruled by how these Properties are set on the main form. If AllowAdditions, for instance, is set to No on the main form, it is effectively set to No on the subforms, regardless of how they are set on the subforms..

To "lock" controls on a main record while leaving them unlocked on a subform, you have to do just that; use the Lock Property for each main form control, with the "Allow" properties set to Yes. It's not as onerous a task as it sounds; you don't have to do one control at a time, can loop thru and lock them with half a dozen or so lines of code.
 
Thank you very much for your response. Can you show me how to lock it and unlock it if I want to add a record plus why is the subforms not being shown if I set the main form to "allowedition=no"?
 

Users who are viewing this thread

Back
Top Bottom