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

Filter datasheet of split form with listbox

Status
Not open for further replies.

IslandNation

IS-IT--Management
Jul 15, 2012
2
0
0
Table tblBodypartExercises is the junction table between tables tblExercises and tblBodyparts, with the fields of each table populated with sample data as follows:

tblExercises
IdExercise (PK)...Exercise (txt)
..1.................Bench Press
..2.................Chin Up
..3.................Curls

tblBodyparts
IdBodypart (PK)...Bodypart (txt)
..1.................Chest
..2.................Shoulders
..3.................Triceps
..4.................Biceps
..5.................Traps
..6.................Lats

tblBodypartExercises
IdExercise (PK)...IdBodypart (PK)
..1.................1
..1.................2
..1.................3
..2.................4
..2.................5
..2.................6
..3.................4

Form frmExercises is a split form with a datasheet on top listing the exercises and a list box on bottom listing the bodyparts. What I want to do is select multiple bodyparts of the list box to limit (filter) the exercises of the database. How?! I can't figure it out. Please help! Thanks!
 
There are many ways to do this. This is the way I have used quite often.

Lets say your list box is call "partList".

Make the recordset for your datasheet a query if it not already. It should have a body parts column and then all the other columns you want.

Add this condition to the body parts column: LIKE "*" & Forms!frmExercises!partList.value & "*"
**Using LIKE will let you see all exercises if the field is blank

Is the datasheet a subform? If so lets call it "subDatasheet" for now.

Add this code to the AfterUpdate event of the partList combobox

`DoCmd.Requery(me.name)`

This might not work right out of the bag. You might have to perform a few tweaks to work with your situation.
Good Luck


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top