Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the filter on a subform

Status
Not open for further replies.

NetNomad312

Technical User
Jun 16, 2004
27
US
Sorry, I know this is probably a newbie question, but my VB is rusty and I'm rather new to Access. I'm trying to create a form in Access 2003 that includes two main things: a list box and a subform. The list box contains a list of item names as entered in a certain table. What I want is to get the subform, in datasheet view, to display whichever records have the name that you double-click on the list. I read in MSDN that you can set this by using the filter property ("Me.filter = [whatever]"). So I tried accessing the subform's filter property from the list box's On Double-Click command. I was trying:

[On double-clicking the list box]
Subform.Form.Filer = [the list box's itemdata]

When I double click, I get an error saying I can't change this property. Then I tried applying a test filter on the subform's Form_Load, and that worked. But I apparantly can't access the subform's filter from the main form (or any control on it). So how do I pass this string to the subform?
 
You need:
Me.FilterOn = True
in the Form_Load of the subform.
 
The syntax for your filter command does not look right to me for a start, have you tried

Subform.Form.Filter = "[CustName] = '" & lstboxvalue & "'"
Subform.Form.FilterOn = true

HTH Savil

 
Thanks, heh... I figured this out on my own. I didn't read the FAQs first, sorry. :-/
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top