If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Multiple combo boxes that filters records in a form
Could anyone please help me with the following?
How to: 1) create 2 combo boxes, each dispalying unique values from a field of table/query containng multiple occurences of each values? 2) then sychronize these 2 combo boxes and filter records in a form based on my selection in the combo boxes? Example: tblGrocery (containing fields of Category, Type, ProductName) cboCategory cboType (depend on the selection of cboCategory) frmGrocery (based on tblGrocery) After selecting Fruit in cboCategory, then Apple in cboType, records under Apple (red apple, green apple,...) are filtered in a form. Your kind help is much appreciated from a very frustrated man! |
#2
|
|||
|
|||
Multiple combo boxes that filters records in a form
See:
Limit content of combo/list boxes a: http://www.mvps.org/access/forms/frm0028.htm -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Sam Kuo" .(donotspam) wrote in message ... Could anyone please help me with the following? How to: 1) create 2 combo boxes, each dispalying unique values from a field of table/query containng multiple occurences of each values? 2) then sychronize these 2 combo boxes and filter records in a form based on my selection in the combo boxes? Example: tblGrocery (containing fields of Category, Type, ProductName) cboCategory cboType (depend on the selection of cboCategory) frmGrocery (based on tblGrocery) After selecting Fruit in cboCategory, then Apple in cboType, records under Apple (red apple, green apple,...) are filtered in a form. Your kind help is much appreciated from a very frustrated man! |
#3
|
|||
|
|||
Multiple combo boxes that filters records in a form
Thanks alot, Allen.
Do you know how I can do about the first problem ( i.e. How to create a combo box that displays unique values from a field of table/query containng multiple occurences of each values?) for example In tblGrocery, contains 3 fields: Category-Type-Product 1st record: Fruit-Apple-GreenApple 2nd record: Fruit-Apple-RedApple 3rd record: Meat-Beef-Tbone 4th record: Vegi-Lettuce-FancyLettuce Fruit appears twice in the drop-down list of CategoryComboBox, and the same for Apple in TypeComboBox. But it makes no sense to include any item more than once in a combo box list since it's only used to filter records (to filter Apple from the rest in this case) on a form. Any comments welcome. Cheers "Allen Browne" wrote: See: Limit content of combo/list boxes a: http://www.mvps.org/access/forms/frm0028.htm -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Sam Kuo" .(donotspam) wrote in message ... Could anyone please help me with the following? How to: 1) create 2 combo boxes, each dispalying unique values from a field of table/query containng multiple occurences of each values? 2) then sychronize these 2 combo boxes and filter records in a form based on my selection in the combo boxes? Example: tblGrocery (containing fields of Category, Type, ProductName) cboCategory cboType (depend on the selection of cboCategory) frmGrocery (based on tblGrocery) After selecting Fruit in cboCategory, then Apple in cboType, records under Apple (red apple, green apple,...) are filtered in a form. Your kind help is much appreciated from a very frustrated man! |
#4
|
|||
|
|||
Multiple combo boxes that filters records in a form
Use a query for the combo box Row Source. That query should have SELECT
DISTINCT in it or else it should be a Totals query that is grouped on the category field. Same for the type combo box. -- Ken Snell MS ACCESS MVP "Sam Kuo" .(donotspam) wrote in message ... Thanks alot, Allen. Do you know how I can do about the first problem ( i.e. How to create a combo box that displays unique values from a field of table/query containng multiple occurences of each values?) for example In tblGrocery, contains 3 fields: Category-Type-Product 1st record: Fruit-Apple-GreenApple 2nd record: Fruit-Apple-RedApple 3rd record: Meat-Beef-Tbone 4th record: Vegi-Lettuce-FancyLettuce Fruit appears twice in the drop-down list of CategoryComboBox, and the same for Apple in TypeComboBox. But it makes no sense to include any item more than once in a combo box list since it's only used to filter records (to filter Apple from the rest in this case) on a form. Any comments welcome. Cheers "Allen Browne" wrote: See: Limit content of combo/list boxes a: http://www.mvps.org/access/forms/frm0028.htm -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Sam Kuo" .(donotspam) wrote in message ... Could anyone please help me with the following? How to: 1) create 2 combo boxes, each dispalying unique values from a field of table/query containng multiple occurences of each values? 2) then sychronize these 2 combo boxes and filter records in a form based on my selection in the combo boxes? Example: tblGrocery (containing fields of Category, Type, ProductName) cboCategory cboType (depend on the selection of cboCategory) frmGrocery (based on tblGrocery) After selecting Fruit in cboCategory, then Apple in cboType, records under Apple (red apple, green apple,...) are filtered in a form. Your kind help is much appreciated from a very frustrated man! |
#5
|
|||
|
|||
Multiple combo boxes that filters records in a form
Many thanks to those who helped me out with my problems before.
I now have two dependent combo boxes working together. But neither of combo boxes filter the records in a form. Any comments appreciated. Cheers (NB. both combo boxes and the form are based on different tables in Access2002) ------------------------------------------------------------------------------- cboCategory RowSourceType: Table/Query RowSource: SELECT DISTINCTROW [CategoryID], [Category] FROM tblCategory ORDER BY [Category]; ColumnWidth: 0",1" BoundColumn: 1 AfterUpdate: [Event Procedure] Private Sub cboCategory_AfterUpdate() Me.cboType.RowSource = "SELECT Type FROM" & _ " tblType WHERE CategoryID = " & Me.cboCategory & _ " ORDER BY Type" Me.cboType = Me.cboType.ItemData(0) End Sub ------------------------------------------------------------------------------- cboType BoundColumn: 1 ------------------------------------------------------------------------------- frmShop RecordSource: qryAllProducts (contains all fields in tblCategory and tblType) Filter: (Blank) "Ken Snell" wrote: Use a query for the combo box Row Source. That query should have SELECT DISTINCT in it or else it should be a Totals query that is grouped on the category field. Same for the type combo box. |
#6
|
|||
|
|||
Multiple combo boxes that filters records in a form
Is the query that is the form's recordsource using the values from the two
combo boxes to filter its records? And do you do a requery of the form's recordsource at some point after you choose the values in the combo boxes? -- Ken Snell MS ACCESS MVP "Sam Kuo" .(donotspam) wrote in message ... Many thanks to those who helped me out with my problems before. I now have two dependent combo boxes working together. But neither of combo boxes filter the records in a form. Any comments appreciated. Cheers (NB. both combo boxes and the form are based on different tables in Access2002) -------------------------------------------------------------------------- ----- cboCategory RowSourceType: Table/Query RowSource: SELECT DISTINCTROW [CategoryID], [Category] FROM tblCategory ORDER BY [Category]; ColumnWidth: 0",1" BoundColumn: 1 AfterUpdate: [Event Procedure] Private Sub cboCategory_AfterUpdate() Me.cboType.RowSource = "SELECT Type FROM" & _ " tblType WHERE CategoryID = " & Me.cboCategory & _ " ORDER BY Type" Me.cboType = Me.cboType.ItemData(0) End Sub -------------------------------------------------------------------------- ----- cboType BoundColumn: 1 -------------------------------------------------------------------------- ----- frmShop RecordSource: qryAllProducts (contains all fields in tblCategory and tblType) Filter: (Blank) "Ken Snell" wrote: Use a query for the combo box Row Source. That query should have SELECT DISTINCT in it or else it should be a Totals query that is grouped on the category field. Same for the type combo box. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Value of check boxes in word form are lost when emailing the form. | Dave Jung | General Discussion | 1 | June 24th, 2004 07:12 PM |
Manipulate records of 2 tables | Praveen Manne | Using Forms | 11 | June 14th, 2004 02:41 PM |
matching multiple forms on open to form records | EdwardA | Using Forms | 0 | June 10th, 2004 06:38 PM |
Multiple Selections in Combo Boxes | Matt | Using Forms | 3 | June 2nd, 2004 11:59 PM |
Multiple combo boxes | Lee | Worksheet Functions | 2 | May 6th, 2004 02:49 PM |