Populate textbox in a subform

R

Ross

Hi Guys
Trying to populate a textbox in a subform using afterupdate on a combobox on
the main form to refresh a listbox, get error "object doesn't support this
property method."

Any ideas?

Cheers Ross
 
K

Ken Sheridan

Ross:

It could be that you are not referencing the sub form's text box correctly
(its done via the Form property of the parent form's subform control) but
without more information its hard to say. What is the code you are using in
the combo box's AfterUpdate event procedure?

Ken Sheridan
Stafford, England
 
R

Ross

Hi Ken
My Code was:
Forms!Company!Callssubform!txtEmployee=Forms!Company!txtEmployee

I have now found one solution by creating a default value linked to the
Login Form of my application and not the master form "Company"

Would be obliged if you could help as I have tried all sorts to achieve it
in the normal way.

Chees Ross
 
K

Ken Sheridan

Ross:

Your code should be OK if Callssubform is the name of the subform control on
the parent form, i.e. the control which houses the subform. It would not
work if Callssubform is the name of the underlying form object, i.e. the
source object of the subform control, unless it was also the name of the
subform control. Both can legitimately have the same name, but I always use
different names, prefixing a subform control with sfr and a form object used
as a subform with frmsub.

If you add a subform control to a form from the toolbox Access gives it a
default name such as Child0, Child1 etc., which you can change in the
control's properties sheet.

The full syntax for referencing a control on a subform is:

Forms!NameOfParentForm!NameOfSubformControl.Form!NameOfControlOnSubform

..Form is a reference to the subform's control's Form property, and can be
omitted, though I normally include it for clarity.

If the code is in the parent form's module you can shorten it to:

Me!NameOfSubformControl.Form!NameOfControlOnSubform

If the code is in the module of another subform in the same parent form you
can use the Parent property to refer to the parent form:

Me.Parent!NameOfSubformControl.Form!NameOfControlOnSubform

Ken Sheridan
Stafford, England
 
R

Ross

Wow Ken
Took a bit of getting my head round that one. But yes got it to work, learn
something new every day. Much appreciated.
Cheers Ross
 

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