Allow Edit in a subform

G

Guest

I have a form with a subform which is opened as read only.
A button when clicked allows users to edit the record (Using: Form
Name.Allow Edits=True)
The above works fine exept on the sub form which remains read only.
Is there a way to get the subform to allow edits?
 
W

Wayne Morgan

I show that the parent and subform are controlled separately. You have to
set the AllowEdits property of each to the desired value. To refer to the
subform from code running on the parent form, the syntax would be:

Me.NameOfSubformControl.Form.AllowEdits = True

The subform control is the control on the main form that works as a
container for the subform. This is the control where you set the Parent and
Child link properties.
 
G

Guest

Many thanks, I was trying set allow edits to the actual form as opposed to
the container, as you put it.
 
W

Wayne Morgan

You do actually set it to the form, hence the ".Form" in the syntax, but to
refer to a subform, the path goes through the container control.
 
G

Guest

I had a similar problem, and your post solved it for me.

Many thanks,
Oli
04.06.06 16.26 hst
 
G

Guest

I am working on the same problem, and apparently I am not understanding the
differnce between the subform name (in my case 'frmSupplierSubform', which I
named myself) and the subform 'control' that needs to be referenced in the
code. When I use 'Me.frmSupplierSubform.frmSuppliers.AllowEdits = True' it
highlights the subform name with the error message 'Method or data member not
found.'
Can you shed a little more light on the issue for me? The name of my main
form is 'frmSuppliers'.
~KK
 
W

Wayne Morgan

The subform control is a container control on the main form. This control
holds the subform. You can change subforms programmatically while the main
form is open by changing the controls SourceObject property. The easiest way
to get the name of the subform control is to open the main form in design
view, open the Properties sheet, and click on the subform ONE time. The drop
down on the Properties dialog should show the name of the subform control.
To verify that your on the control and not in the subform itself, look at
the Data tab. There should be 2 properties for the Link Child/Master Fields.
If you're in the subform itself, just click something on the main form then
click the subform again ONE time.

Once you have this name, the syntax is:

Me.NameOfSubformControl.Form.AllowEdits = False 'or True

The word "form" is not a place holder for the name of the subform, it is
literally the word "form".
 
G

Guest

I'm somewhat new to some of this myself, but note that Wayne Morgan's earlier
post used the syntax:
Me.NameOfSubformControl.Form.AllowEdits = True

In your case, I would change your:
Me.frmSupplierSubform.frmSuppliers.AllowEdits = True

to:
Me.frmSupplierSubform.Form.AllowEdits = True

See how that works for you.

Oli
04.18.06 13.16 hst
 

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