Requery Subform not working

K

kc-mass

I have a form which is two sub levels down

The top level form is "frmTabs"

The first sublevel is "frmTarget2"

The second sublevel is "frmProviderNo"

The forms data source for the above form is "tblProviderNo"

I want to requery the form.

I have tried several forms of expression - most recently:

" Docmd.Requery
Forms!frmTab.frmTracking2.Form!frmProviderNo!ProviderNo"

I get the error:
"Microsoft Access can't find the field 'frmProviderNo' referred to
in your expression"

Any ideas?

Thx

Kevin
 
K

Klatuu

Forms!frmTab!Tracking2ControlName.Form!ProviderNoControlName.Form!ProviderNo.Requery

First, you use the name of the control on the form, not the name of the form
being used as the subform. Also, you said you want to requery the subform,
but using a control name will cause it to requery only that control. To
requery the subform:

Forms!frmTab!Tracking2ControlName.Form!ProviderNoControlName.Form!ProviderNo.Requery
 
K

kc-mass

Hi Thanks for answering. I am not much on forms. Is the expression
"Tracking2ControlName" literal or does it need to have something substituted
for it.

I kind of understand that a subform is a control to a parent form but how is
it named - referred to?

thx

Kevin
 
K

Klatuu

You use the name of the subform control. To avoid confusion, it should not
be the same name as the form identified in the subform control's Source
Object property. The Source Object Property is what is used to identify
what form to show in the control. So the basic syntax is:

Forms!FormName!SubformControlName.Form!ControlName
 

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

Similar Threads


Top