Multiple filters on a form to filter a subform

  • Thread starter nouveauricheinvestments
  • Start date
N

nouveauricheinvestments

Hi,

I have one filter on a form to filter a sub form. My form is bound to
the parent table and I have a combo box on my form which looks up the
ID and value in that said parent table. My subform is linked via
master/child fields as follows:

Master Field Link: ID (I think this is referring to the ID field in my
combo box, which isn't visible, on the form)
Child Field Link: TradeSpecialist_ID (Foreign Key in my child table)

To make the table update, I have a macro code which is the following:

SearchForRecord: "=[ID]= "& Str(Nz([Screen].[ActiveControl],0))

I can't figure out how to add a second filter to my form. i.e. Right
now the one combo box on the form searches for all tickets by a given
trade specialist. I would like to have another combo box on the form
that I could select from which would instead maybe show me all tickets
for a given account instead. How would I do that?

Thanks
 
N

NTC

one approach is to source your subform on a query; and use your form's combo
boxes to define filtering criteria for this query.

(with the subform sourced on this query it may or may not conflict with your
existing master/child relationship depending on the data)

you might want to start fresh to experiment...you won't need the macro and
you won't need to define any relationship between the subform and main form..

also remember to requery the subform after selections...
 
R

R Tanner

one approach is to source your subform on a query;  and use your form'scombo
boxes to define filtering criteria for this query.

(with the subform sourced on this query it may or may not conflict with your
existing master/child relationship depending on the data)

you might want to start fresh to experiment...you won't need the macro and
you won't need to define any relationship between the subform and main form..

also remember to requery the subform after selections...



I have one filter on a form to filter a sub form.  My form is bound to
the parent table and I have a combo box on my form which looks up the
ID and value in that said parent table.  My subform is linked via
master/child fields as follows:
Master Field Link: ID (I think this is referring to the ID field in my
combo box, which isn't visible, on the form)
Child Field Link: TradeSpecialist_ID (Foreign Key in my child table)
To make the table update, I have a macro code which is the following:
SearchForRecord: "=[ID]= "& Str(Nz([Screen].[ActiveControl],0))
I can't figure out how to add a second filter to my form.  i.e. Right
now the one combo box on the form searches for all tickets by a given
trade specialist.  I would like to have another combo box on the form
that I could select from which would instead maybe show me all tickets
for a given account instead.  How would I do that?
Thanks- Hide quoted text -

- Show quoted text -

I didn't need to do anything to 'requery'. I just defined the
criteria for my query as the combo box on my form, deleted the macro,
deleted the relationships, and it works wonderfully.

Hey you wouldn't by chance know how to add an option to select all of
the records in my query would you? Like have a button to view all or
have an All option in my dropdown?
 
N

NTC

assuming you mean that 'All' is when the combobox has nothing selected; put
this on the next criteria line making it an OR

Like
IIf(IsNull([Forms]![FormName].[ComboName]),"*",([Forms]![FormName].[ComboName]))



R Tanner said:
one approach is to source your subform on a query; and use your form's combo
boxes to define filtering criteria for this query.

(with the subform sourced on this query it may or may not conflict with your
existing master/child relationship depending on the data)

you might want to start fresh to experiment...you won't need the macro and
you won't need to define any relationship between the subform and main form..

also remember to requery the subform after selections...



I have one filter on a form to filter a sub form. My form is bound to
the parent table and I have a combo box on my form which looks up the
ID and value in that said parent table. My subform is linked via
master/child fields as follows:
Master Field Link: ID (I think this is referring to the ID field in my
combo box, which isn't visible, on the form)
Child Field Link: TradeSpecialist_ID (Foreign Key in my child table)
To make the table update, I have a macro code which is the following:
SearchForRecord: "=[ID]= "& Str(Nz([Screen].[ActiveControl],0))
I can't figure out how to add a second filter to my form. i.e. Right
now the one combo box on the form searches for all tickets by a given
trade specialist. I would like to have another combo box on the form
that I could select from which would instead maybe show me all tickets
for a given account instead. How would I do that?
Thanks- Hide quoted text -

- Show quoted text -

I didn't need to do anything to 'requery'. I just defined the
criteria for my query as the combo box on my form, deleted the macro,
deleted the relationships, and it works wonderfully.

Hey you wouldn't by chance know how to add an option to select all of
the records in my query would you? Like have a button to view all or
have an All option in my dropdown?
 

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