Tab Controls

M

MP

I have a form with several tab control pages

Each tab consists of a subform created using an
underlying query. Each query has multiple criteria to
limit the displayed records to a select subset.

The Queries produce the correct/expected output when
viewed as a query. When used in a single form (no tab
controls, no subforms) the correct/expected output is
displayed.

Problem arises when these same queries are used as a
basis for subforms on a series of tab control pages.
Only the criteria linking the subform back to the
original form on the tab controls is effecting the
records displayed. The other criteria placed on the
records in the underlying query is not being recognized.

Anyone offer some insight? Are we limited to a single
criteria when using tab controls? If there is a way to
use multiple criteria, PLEASE let me know.

Thanks!
 
D

Dirk Goldgar

MP said:
I have a form with several tab control pages

Each tab consists of a subform created using an
underlying query. Each query has multiple criteria to
limit the displayed records to a select subset.

The Queries produce the correct/expected output when
viewed as a query. When used in a single form (no tab
controls, no subforms) the correct/expected output is
displayed.

Problem arises when these same queries are used as a
basis for subforms on a series of tab control pages.
Only the criteria linking the subform back to the
original form on the tab controls is effecting the
records displayed. The other criteria placed on the
records in the underlying query is not being recognized.

Anyone offer some insight? Are we limited to a single
criteria when using tab controls? If there is a way to
use multiple criteria, PLEASE let me know.

Thanks!

I just answered this same question for "maureen" in this newsgroup. On
the off chance that you are a different person, here's a copy of my
response:

<quote>
Post the SQL from one of these queries. It sounds to me as though the
query has a criteriton that refers to a control on a form via a
"Forms!FormName!ControlName" reference, but the form that it refers to
is not now open as a main form, but instead is only open as a subform.
Subforms are not members of the Forms collection, and so can't be
referred to directly that way. Instead, you have to go through the main
form and the Form property of the subform control on that main form;
along these lines:

Forms!MainForm!sfSubformName.Form!ControlName

In the above, "MainForm" is the name of the main form, "sfSubformName"
is the name of the subform control on that form, the control that acts
as a window on the form object being used as a subform, and
"ControlName" is the name of the control on that form.
</quote>
 
G

Guest

Dick,

Many Thanks for your response - I did post a separate
request earlier today and was unsure anyone would respond
to it again so I started a new message. I had not seen
your 2nd response to my initial inquiry - my apologies
for any duplicated effort I may have caused.

I understand what you are saying - and I am referencing
the SUBFORM as such - following is an example of the SQL
in one of the queries

SELECT tblQuantityBreaks.QBID,
tblQuantityBreaks.InquiryID, tblQuantityBreaks.InqProdID,
tblQuantityBreaks.PrimaryQuantity, tblQuantityBreaks.Units
FROM tblQuantityBreaks
WHERE (((tblQuantityBreaks.InquiryID)=[Forms]![Inquiry]!
[InquiryID]) AND ((tblQuantityBreaks.InqProdID)=[Forms]!
[Inquiry]![InqProd Form Query subform].[Form]!
[InqProdId]));

In the above example the InquiryID field is working (but
that piece of criteria was also a part of the process to
insert the subform on a tab control page). The criteria
to limit the InqProdID field has no effect in the subform
but does work when, with the form and all it's tab
control pages is open, I open/view the query.

I think I may need to run a macro to Requery every time a
new record or tab control page is selected - does this
sound like it should be a necessary step to you?

THANKS AGAIN!

I hope I'm making sense and that you can offer a solution
or explanation -
 
D

Dirk Goldgar

Dick,

Many Thanks for your response - I did post a separate
request earlier today and was unsure anyone would respond
to it again so I started a new message. I had not seen
your 2nd response to my initial inquiry - my apologies
for any duplicated effort I may have caused.

Generally you should wait at least a day before reposting to a new
thread; otherwise the newsgroup gets filled up with reposts by
impatient people. Remember that you can't really expect fast turnaround
from a newsgroup.

Now to your question ...
I understand what you are saying - and I am referencing
the SUBFORM as such - following is an example of the SQL
in one of the queries

SELECT tblQuantityBreaks.QBID,
tblQuantityBreaks.InquiryID, tblQuantityBreaks.InqProdID,
tblQuantityBreaks.PrimaryQuantity, tblQuantityBreaks.Units
FROM tblQuantityBreaks
WHERE (((tblQuantityBreaks.InquiryID)=[Forms]![Inquiry]!
[InquiryID]) AND ((tblQuantityBreaks.InqProdID)=[Forms]!
[Inquiry]![InqProd Form Query subform].[Form]!
[InqProdId]));

In the above example the InquiryID field is working (but
that piece of criteria was also a part of the process to
insert the subform on a tab control page). The criteria
to limit the InqProdID field has no effect in the subform
but does work when, with the form and all it's tab
control pages is open, I open/view the query.

I think I may need to run a macro to Requery every time a
new record or tab control page is selected - does this
sound like it should be a necessary step to you?

I think you've probably put your finger on it. Every time a new value
appears in the InqProdId control on the subform [InqProd Form Query
subform], you're going to have to requery any other subforms that depend
on it. That would mean requerying in the subform's Current event and in
the AfterUpdate event of InqProdId. Since I don't know which subforms
use the query you quoted as their recordsources, I can't tell you
exactly how to requery them. I would use VBA code to do it, but if
you're more comfortable with macros you can do it that way.
 

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