Shimon,
To filter records in the form's recordsource, you will want to use the form's Filter and FilterOn properties. You would put the code to apply the filters in the AfterUpdate event of your combo boxes. Here's a sample:
Dim strSQL as String
strSQL = "SELECT Field1, Field2, etc. FROM MyTable WHERE Field1 = " & Me!cboCombo1 & " AND Field2 = " & cboCombo2
Me.Filter = strSQL Me.FilterOn = True
Look up these properties in the online help. One note - you might also want to but a command button on your form to turn off filtering to allow your users to see all records.
"Shimon" <MalcolmX[ at ]fromru.com> wrote in message news:efjsBaORJHA.420[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text] > What would the code be to filter the records of the form, based on all the > combo boxes, where when the form opens there are no values in the combo > boxes, and as I choose values from the combo boxes i want the records > filtered as I go. > Shimon > > Scott Lichtenberg wrote: >> Angie, >> >> You need to change the rowsource property of the dependent combos boxes >> based on the value selected in your primary combo box. Add code like the >> following to the AfterUpdate event of your combo box or list box. >> >> Dim strSQL as string >> >> strSQL = "SELECT Field1, Field2, etc FROM MyTable WHERE Field1 = " & >> Me!cboCombo1 >> Me!cboCombo2.RowSource = strSQL >> >> >> "angie" <angie[ at ]discussions.microsoft.com> wrote in message >> news:DFCBFE2A-B552-4A9B-A3B5-6D91D259E95E[ at ]microsoft.com... >>> i have a form with 4 combos and a listbox. how can i limit(filter) the >>> values >>> of a combo based on the values selected on another combo and the list >>> box? >>
|