Getting a subform control to requery

  • Thread starter szag via AccessMonster.com
  • Start date
S

szag via AccessMonster.com

Main Form : F_BU
Subform1: F_BU_Cat2
SubForm2: F_BU_Cat3

When I click on one of the records in subform1 (field BillCat) the OnClick
event uses the value in the field as a criteria in a query that is used in
the combox (cbxCat3) in Subform 2. Here is the code I was trying to use:

Me.Parent!F_BU_Cat3.Form!cbxCat3.Requery

It was working for a while but now not when I click on the "BillCat" field in
Subform 1 I get: Method: Form" of Object ' _Subform' Failed.
 
J

Jeanette Cunningham

I find that in A2007, I am seeing this error message every now and then,
whereas in A2003 and earlier, it was very rare.
I have found that small things wrong can give this error message.

Does the code compile?
Have you checked that the combo has the correct record source?, the forms
have correct record sources?
Have you checked for correct names of the objects involved?

Have you checked to see if any of the forms involved have been corrupted,
perhaps the combo has become corrupted.
I can't remember all the things that can give this error.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
S

szag via AccessMonster.com

Thanks Jeanette - unfortunately I can't look at it right now but in the
meantime ...did the code look ok? I just picked that up from a differnet
thread.

Jeanette said:
I find that in A2007, I am seeing this error message every now and then,
whereas in A2003 and earlier, it was very rare.
I have found that small things wrong can give this error message.

Does the code compile?
Have you checked that the combo has the correct record source?, the forms
have correct record sources?
Have you checked for correct names of the objects involved?

Have you checked to see if any of the forms involved have been corrupted,
perhaps the combo has become corrupted.
I can't remember all the things that can give this error.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Main Form : F_BU
Subform1: F_BU_Cat2
[quoted text clipped - 9 lines]
in
Subform 1 I get: Method: Form" of Object ' _Subform' Failed.
 
J

Jeanette Cunningham

Yes the code looked OK in a general way.
Now that I know you are adapting some other code, make sure you have the
correct name for the subform and the subform control.

Make sure that
Me.Parent!F_BU_Cat3.Form!cbxCat3.Requery

Is using the name of the subform control and not the name of the subform
inside the subform control.
The idea is shown below, substitute the name of your subform control.

Me.Parent.[NameOfSubformControl].Form.cbxCat3.Requery

Note that the subform may have a different name from the subform control.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia



szag via AccessMonster.com said:
Thanks Jeanette - unfortunately I can't look at it right now but in the
meantime ...did the code look ok? I just picked that up from a differnet
thread.

Jeanette said:
I find that in A2007, I am seeing this error message every now and then,
whereas in A2003 and earlier, it was very rare.
I have found that small things wrong can give this error message.

Does the code compile?
Have you checked that the combo has the correct record source?, the forms
have correct record sources?
Have you checked for correct names of the objects involved?

Have you checked to see if any of the forms involved have been corrupted,
perhaps the combo has become corrupted.
I can't remember all the things that can give this error.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Main Form : F_BU
Subform1: F_BU_Cat2
[quoted text clipped - 9 lines]
in
Subform 1 I get: Method: Form" of Object ' _Subform' Failed.
 

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