Subform AllowEdits control

K

K@foss-dental

No matter what I do, I can't seem to affect the AllowEdits control in my
subform. I have a command button that runs a macro changing the property of
the main form to allow editing which works just fine. I have tried both
macro and VBA but no luck making the subform editable. I am using continuous
form view on the subform and single form view on the main form, if that makes
any difference.
What am I missing?
 
K

Ken Snell \(MVP\)

Are you using the correct name for the subform in your code?

Me.SubformName.Form.AllowEdits = True

where SubformName is the name of the subform control (the control that holds
the subform object).
 
K

K@foss-dental

This is what I HAD in the macro item
[Forms]![frmSuppliers]![frmSupplierSubform].[AllowEdits]
Expression set to 'Yes'.
I changed it to
[Forms]![frmSupplierSubform]![frmSuppliers].[AllowEdits]
Now it says it can't find the Subform, so I guess my syntax is still off.
 
K

Ken Snell \(MVP\)

Ohhh... you're using a macro here, not VBA code. OK -

The "form" order that you were using for the "Item" is correct:
[Forms]![frmSuppliers]![frmSupplierSubform].[AllowEdits]

However, it's a common error to think that the name of the subform is the
same as the name of the form that is being used as the subform. Subforms, as
you note, are referenced through the main form. You must use the name of the
subform control for the subform portion of the reference. Open the main form
(frmSuppliers) in design view, click on the top edge of the subform control,
open the Properties window, select the Other tab, and see what name is in
the Name property box. That is the name that you need to use in your
expression in place of the fmrSuppplierSubform name.

Also, because you're referencing a property of the subform form object, it's
best to include the .Form that I had in my example. Thus, your expression
should be this:
[Forms]![frmSuppliers]![ActualNameOfSubformControl].[Form].[AllowEdits]
--

Ken Snell
<MS ACCESS MVP>


K@foss-dental said:
This is what I HAD in the macro item
[Forms]![frmSuppliers]![frmSupplierSubform].[AllowEdits]
Expression set to 'Yes'.
I changed it to
[Forms]![frmSupplierSubform]![frmSuppliers].[AllowEdits]
Now it says it can't find the Subform, so I guess my syntax is still off.


Ken Snell (MVP) said:
Are you using the correct name for the subform in your code?

Me.SubformName.Form.AllowEdits = True

where SubformName is the name of the subform control (the control that
holds
the subform object).

--

Ken Snell
<MS ACCESS MVP>

message
 

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