Open suform with the dataentry setting to yes.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

A combo box in the form selects a record and it is required that a sub-form
has a DataEntry setting of yes when the combo box selection is changed. The
existing code for the combo box OnChange event includes:
Forms![FormName].Form![SubFormName].DataEntry=Yes. When a selection is made
in the combobox, an error message says "Object does not support this property
or method". When DeBug is clicked, the above code is highlighted in the VB
editor. Question is what is wrong?
 
JimN said:
A combo box in the form selects a record and it is required that a sub-form
has a DataEntry setting of yes when the combo box selection is changed. The
existing code for the combo box OnChange event includes:
Forms![FormName].Form![SubFormName].DataEntry=Yes. When a selection is made
in the combobox, an error message says "Object does not support this property
or method". When DeBug is clicked, the above code is highlighted in the VB
editor. Question is what is wrong?

[SubFormName] refers to the subform control on the main form, not to the
form contained within the subform control. Try [SubFormName].Form.
 
JimN said:
A combo box in the form selects a record and it is required that a
sub-form has a DataEntry setting of yes when the combo box selection
is changed. The existing code for the combo box OnChange event
includes: Forms![FormName].Form![SubFormName].DataEntry=Yes. When a
selection is made in the combobox, an error message says "Object does
not support this property or method". When DeBug is clicked, the
above code is highlighted in the VB editor. Question is what is wrong?

Try this:

Me![SubFormName].Form.DataEntry = True

where "SubFormName" is the name of the subform *control* on the main
form -- that is, the control that provides the window within which you
view the subform. This may or may not be the same as the name of the
form object being displayed in that window.

I also recommend using the combo box's AfterUpdate event for this,
rather than the Change event. If the user types in the combo box rather
than using the mouse, the Change event will fire for each character
typed.
 
Tried Me![SubFormName].Form.DataEntry = True and
Me![SubFormName].Form.DataEntry = Yes. The Subform does not clear and
previous records are still showing in subform.

Dirk Goldgar said:
JimN said:
A combo box in the form selects a record and it is required that a
sub-form has a DataEntry setting of yes when the combo box selection
is changed. The existing code for the combo box OnChange event
includes: Forms![FormName].Form![SubFormName].DataEntry=Yes. When a
selection is made in the combobox, an error message says "Object does
not support this property or method". When DeBug is clicked, the
above code is highlighted in the VB editor. Question is what is wrong?

Try this:

Me![SubFormName].Form.DataEntry = True

where "SubFormName" is the name of the subform *control* on the main
form -- that is, the control that provides the window within which you
view the subform. This may or may not be the same as the name of the
form object being displayed in that window.

I also recommend using the combo box's AfterUpdate event for this,
rather than the Change event. If the user types in the combo box rather
than using the mouse, the Change event will fire for each character
typed.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Put in Form![FormName]![SubFormName].Form.DataEntry = Yes and subform does
not clear and previous records are still showing.


Brian Coiley said:
JimN said:
A combo box in the form selects a record and it is required that a sub-form
has a DataEntry setting of yes when the combo box selection is changed. The
existing code for the combo box OnChange event includes:
Forms![FormName].Form![SubFormName].DataEntry=Yes. When a selection is made
in the combobox, an error message says "Object does not support this property
or method". When DeBug is clicked, the above code is highlighted in the VB
editor. Question is what is wrong?

[SubFormName] refers to the subform control on the main form, not to the
form contained within the subform control. Try [SubFormName].Form.
 
JimN said:
Tried Me![SubFormName].Form.DataEntry = True and
Me![SubFormName].Form.DataEntry = Yes. The Subform does not clear and
previous records are still showing in subform.

The equivalent code certainly works for me in a test form and subform,
so I suspect one of two things is going on. Possibly (a) that line of
code is never being executed -- so you should set a breakpoint and step
through the code to make sure -- or (b) you've got the wrong name for
"SubFormName" -- it must be the name of the subform control on the main
form, which may or may not be the same as the name of the form object
that the control is displaying.

Please check these possibilities and get back to us.
 
Back
Top