Using a parameter

P

PeterM

I have a form (FormA) which has a subform(FormB). One of the listboxes on
FormB uses a query using a field from FormB as part of the where statement.
I've tried various versions of [forms]![FormA]![FormB].Form![PD_Date]
in the where statement. The query prompts for the value and if I enter it,
the query runs fine. When I try to run it on FormB, it prompts for the
value.

Can anyone let me know what I'm doing wrong?
 
K

Ken Snell

Likely the name of the subform control that is holding "FormB" as the
subform is not named FormB. Open your main form in design view, click on the
top edge of the subform control that is holding FormB as the subform, open
Properties window, click on Name tab, and see what the name of the subform
control is. Use that name instead of FormB in the reference.
 
K

KenSheridan via AccessMonster.com

If the list box is in FormB and the control being referenced as the parameter
is also in FormB you shouldn't need to reference the parent form at all. The
following should work whether FormB is opened directly or as a subform:

Form![PD_Date]

In fact simply referencing the control by name should work:

[PD_Date]

but I prefer to qualify it with the Form property to avoid any possible
ambiguity as to what is being referenced.

Ken Sheridan
Stafford, England
I have a form (FormA) which has a subform(FormB). One of the listboxes on
FormB uses a query using a field from FormB as part of the where statement.
I've tried various versions of [forms]![FormA]![FormB].Form![PD_Date]
in the where statement. The query prompts for the value and if I enter it,
the query runs fine. When I try to run it on FormB, it prompts for the
value.

Can anyone let me know what I'm doing wrong?
 

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