Filtering a subform from a Form

  • Thread starter Gman063 via AccessMonster.com
  • Start date
G

Gman063 via AccessMonster.com

I know this subject has been covered allot, but I don't think I am getting it.
What I am trying to do is basically actively filter a sub form based on what
the user puts in a textbox on the main form. Additionally, I am trying to
have the filter return records that contain the character that the user has
entered. (I.E. if they enter "eg" it will return all records with it in the
string)

Table contains numerous fields but only using three field in the sub form. My
parent form has no control source, just the text boxes I am using to filter
the sub form. The sub form is continuous form based on a query with a command
button that will open a form with all the details. I have been working on
this for quite some time and have run into a brick wall. I am pretty sure I
am over thinking this. Any help will be much appreciated.
 
M

Mike

I have the same thing, which works OK.
I have done as follows:

Suppose:
1) the name of the unbound main form is "MyMainForm"
2) the name of the subform control on the "MyMainForm" is "MySubForm"
3) you want to filter records according to the value of the unbound control
"SearchText" on the main form

Set the DefaultValue property of "searchText" control ="*"
Put the following code for the AfterUpdate property of the "SearchText"
control:

Me.MySubForm.Requery


The record source of the subform should be a query.
Open this query and select the neccesary column and type the following into
the Criteria cell:

Like [Forms]![MyMainForm]![SearchText]

Save the query.

Now type "*eg*" in the "SearchText" control of the main form and press
Enter...
 
G

Gman063 via AccessMonster.com

Mike thanks for the reply. I had actually set my form up that way but left
out the Defualt value property and the use of wild cards. Thanks....works
great now.

Glenn
I have the same thing, which works OK.
I have done as follows:

Suppose:
1) the name of the unbound main form is "MyMainForm"
2) the name of the subform control on the "MyMainForm" is "MySubForm"
3) you want to filter records according to the value of the unbound control
"SearchText" on the main form

Set the DefaultValue property of "searchText" control ="*"
Put the following code for the AfterUpdate property of the "SearchText"
control:

Me.MySubForm.Requery

The record source of the subform should be a query.
Open this query and select the neccesary column and type the following into
the Criteria cell:

Like [Forms]![MyMainForm]![SearchText]

Save the query.

Now type "*eg*" in the "SearchText" control of the main form and press
Enter...
I know this subject has been covered allot, but I don't think I am getting it.
What I am trying to do is basically actively filter a sub form based on what
[quoted text clipped - 9 lines]
this for quite some time and have run into a brick wall. I am pretty sure I
am over thinking this. Any help will be much appreciated.
 

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