subform filter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using CUSTOMERDB and OrderDB as an example: If I have a form1 that uses
as a source, a SELECT statement or a query that joins all orders to their
respective CUSTOMER, I can see displayed all the orders for a given CUSTOMER,
but I cannot change any datafield in ORDERDB.

So I made a commandbuttom that opens a wizard designed SUBFORM2 which has
CYCLE selected as CONTINUOUS RECORDS.

I find that if there is more than one ORDER for any given customer, then
tthe SUBFORM2 displays data from only the first instance of the join.
Apparently the filter was automatically set to cutomerautoID.

If I open the SUBFORM2 and change the filter to ORDERDB (in the properties
pop up) to ORDERautoID, then I can display other instances of the join on the
SUBFORM2.

But when I close the subform2, the filter goes back to cutomerautoID and I
am stuck with the same problem next time.

What am I doing wrong?
 
mark said:
Using CUSTOMERDB and OrderDB as an example: If I have a form1 that
uses as a source, a SELECT statement or a query that joins all orders
to their respective CUSTOMER, I can see displayed all the orders for
a given CUSTOMER, but I cannot change any datafield in ORDERDB.

So I made a commandbuttom that opens a wizard designed SUBFORM2 which
has CYCLE selected as CONTINUOUS RECORDS.

I find that if there is more than one ORDER for any given customer,
then tthe SUBFORM2 displays data from only the first instance of the
join. Apparently the filter was automatically set to cutomerautoID.

If I open the SUBFORM2 and change the filter to ORDERDB (in the
properties pop up) to ORDERautoID, then I can display other instances
of the join on the SUBFORM2.

But when I close the subform2, the filter goes back to cutomerautoID
and I am stuck with the same problem next time.

What am I doing wrong?

Use a main form bound to Customers and a subform showing Orders bound only to
the Orders table. The MasterLink and ChildLink properties of the subform will
automatically filter the subform so it only shows orders for the currently
displayed customer. No need for either form to use a multi-table query.

BTW, a form that you "open" from your main form is NOT a subform. A subform is
a "form within a form" that is contained within a subform control. That is the
only way to get the automatic linking that you are looking for without going
through some code to accomplish the same affect.
 
Back
Top