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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering a subform based on combo list selection

Status
Not open for further replies.

thehhwy

Programmer
Dec 18, 2009
3
US
Hey guys, I took a look at this site and found it to be very useful.

I am a beginner in MS Access but what I am trying to do should be very simple.

So we have a User table and a Furniture table, and the Furniture table has the columns FurnitureIDNumber, FurnitureType and AssignedTo. The name of the user from the User table has a relationship with the AssignedTo from Furniture.

What I want to do is create a form that has all the Users in a combo list and a subform will display all the FurnitureIDNumber and FurnitureType associated with that particular User.

I was confused as to how to approach this, I've seen examples such as

[Forms]![User]![Furniture subform].Form.Filter

but I do not know if this applies, or if I should use VB code

Thanks!
 
I tried the code below, but got an Object Required error

I think [Employee] should be something else,



Private Sub cboEmployee_AfterUpdate()
Supplier.Form.Filter = "[Employee]= '" & cboEmployee & "'"
Supplier.Form.FilterOn = True
End Sub


For more clarification:

My User table has an ID and Employee column
My Furniture table has ID, FurnitureIDNumber, FurnitureType and AssignedTo(Linked to User table's Employee)



 
Ok, just after reviewing my own posts I can see one big error is that I used Supplier, which is not even a table or anything in my database. I think something like

[Forms]![User]![Furniture subform] should be there instead..

something like...


Private Sub cboEmployee_AfterUpdate()
[Forms]![User]![Furniture subform].Form.Filter = "[Employee]= '" & cboEmployee & "'"
[Forms]![User]![Furniture subform].Form.FilterOn = True
End Sub

???

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top