Getting a subform control to requery

  • Follow


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.

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1

0
Reply szag 2/18/2010 12:15:44 AM

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

"szag via AccessMonster.com" <u2885@uwe> wrote in message 
news:a3ca9b7cc5f36@uwe...
> 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.
>
> -- 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201002/1
> 


0
Reply Jeanette 2/18/2010 8:10:31 AM


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 Cunningham wrote:
>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.

-- 
Message posted via http://www.accessmonster.com

0
Reply szag 2/18/2010 12:13:23 PM

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" <u2885@uwe> wrote in message
news:a3d0df5f22389@uwe...
> 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 Cunningham wrote:
>>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.
>
> -- 
> Message posted via http://www.accessmonster.com
>



0
Reply Jeanette 2/18/2010 10:47:13 PM

3 Replies
634 Views

(page loaded in 0.095 seconds)

Similiar Articles:
















7/23/2012 5:51:38 PM


Reply: