How To make a subform uneditable/editable.

  • Thread starter bbrazeau via AccessMonster.com
  • Start date
B

bbrazeau via AccessMonster.com

My question is: I have a form (form1) which has a field that is a look up
wizard to another form (form2). Table normalization has dictated what
information is in each form. When the user is filling out form1 it is very
useful to see the info from form2. For this reason I put a subform on form1
that shows all info from form2 but I don't want the user to mistakenly change
data on the sub form so I set its Allow Edits property to no. Problem is now
when I open Form2 as a regular form its Allow Edits property is set to no.
Whats the easyest way to remedee this? Any help would be appreciated.
 
G

Guest

You could add a line of code in VBA in the onopen:
form.allowedits = true

To do this, go into the form in design view. Click View>Code.

In the drop down boxes, select 'Form' in the left and 'Open' on the right.
After Private sub...., go to a new line and type form.allowedits = true,
ensuring End sub is on the next line.
 
B

bbrazeau via AccessMonster.com

Thanks S Rawson, but doing what you said affects both the subform and the
form. Maybe because they both have the same record source. Is there a way to
set the form.allowedits for form2 form the onopen event of form1? Maybe by
something like: subform.allowedits=false?
 
R

Rick Brandt

bbrazeau said:
Thanks S Rawson, but doing what you said affects both the subform and
the form. Maybe because they both have the same record source. Is
there a way to set the form.allowedits for form2 form the onopen
event of form1? Maybe by something like: subform.allowedits=false?

A form and subform both having the same RecordSource suggests a design flaw. Do
you have them both also displaying the same record?

By the way, you would set AllowEdits of the *subform* to false, not the
AllowEdits of the main form.

Me.SubformControlName.Form.AllowEdits = False
 
B

bbrazeau via AccessMonster.com

I think I got it:

1.Problem: Had a form (form1) with a subform based on (form2) and didn’t want
user to mistakenly change data on subform. If I set (form2)s “form.
allowedits” property to no or yes, it affected both the form and subform
instances.
Solution: When editing form1, if your careful you can pick the subform close
to its edge, right click, and get properties for the subform. In these
properties you set “locked” property to true.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top