Form Filter Issues

  • Thread starter Thread starter Allan Koodray
  • Start date Start date
A

Allan Koodray

I have a form with the following parameters:
Main form based of a query involving several tables
The query prompts the user to enter a company number
The main form contains 3 subforms -all linked by company
All 3 of the subforms are based on the same table

The desire is to break down a P&L statement by different
areas - Revenue, Expenses, Taxes.

If I set a filter on one of the subforms, the filters on
the other 2 subforms are removed.

Can I structure this form/subform so that each of the tabs
would show the appropriate groupings? and if so, how?

Allan Koodray
 
If I set a filter on one of the subforms, the filters on
the other 2 subforms are removed.

Can I structure this form/subform so that each of the tabs
would show the appropriate groupings? and if so, how?

Gee, did not think that setting a filter on one sub-form would effect, or
have anything to do with another sub-form. That don't sound right.

However, you can always bite the bullet, simple code the sql for the
sub-forms. This approach works well if you are not planning to "add" records
to the sub-forms in your screen.


dim strSql as string

strSql = "select * from subTable where ParentLink_id = " & me.id & _
" and LType = 'Revenue'"

me.MySubForm.Form.RecordSouce = strSql

However, I do think/believe that using a filter on the sub-forms should
work.

are you going:

me.MySubForm.Form.Filter = "LType = 'Revenue'"
me.MySubForm.Form.filterOn = true


So, either of the above will work, but I would give the filter idea one more
try. If it don't work (and it should??), then bite the bullet, and just
stuff the sql right into the sub-form. By whacking the sub-form with direct
sql it don't have much of a choice as to what it will do!

However, I still am voting for the filter idea. If you are trying to use the
filter buttons on the menu bar, then things are real tough...since any kind
of focus problem will hit the wrong form. So, use the filter property of the
form as example above in code...and you should be ok.
 
-----Original Message-----


Gee, did not think that setting a filter on one sub-form would effect, or
have anything to do with another sub-form. That don't sound right.

However, you can always bite the bullet, simple code the sql for the
sub-forms. This approach works well if you are not planning to "add" records
to the sub-forms in your screen.


dim strSql as string

strSql = "select * from subTable where ParentLink_id = " & me.id & _
" and LType = 'Revenue'"

me.MySubForm.Form.RecordSouce = strSql

However, I do think/believe that using a filter on the sub-forms should
work.

are you going:

me.MySubForm.Form.Filter = "LType = 'Revenue'"
me.MySubForm.Form.filterOn = true


So, either of the above will work, but I would give the filter idea one more
try. If it don't work (and it should??), then bite the bullet, and just
stuff the sql right into the sub-form. By whacking the sub-form with direct
sql it don't have much of a choice as to what it will do!

However, I still am voting for the filter idea. If you are trying to use the
filter buttons on the menu bar, then things are real tough...since any kind
of focus problem will hit the wrong form. So, use the filter property of the
form as example above in code...and you should be ok.


--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
(e-mail address removed)
http://www.attcanada.net/~kallal.msn



.
Thanks for the help. I was finallly able to get it to
work using the sub-form filter. I was close but not there -
you put me in the right direction.

Allan Koodray
 
Back
Top