SteveL13
asked on
Filter records in a subform based on a selection in a forms header combobox
I have a main form and a datasheet subform. I want to filter records in a subform based on a selection in a forms header combobox. How can I do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it with:
Private Sub cboClientRecordID_AfterUpdate()
On Error GoTo Err_cboClientRecordID_AfterUpdate
Me.subfrmScheduleRecordsDS.Form.Filter = "[ClientID] = " & Me.cboClientRecordID
Me.subfrmScheduleRecordsDS.Form.FilterOn = True
Me.subfrmScheduleRecordsDS.Requery
Exit_cboClientRecordID_AfterUpdate:
Exit Sub
Err_cboClientRecordID_AfterUpdate:
MsgBox "Error Number: " & Err.Number & vbCrLf & "Error Description: " & Err.Description & vbCrLf & "Error Source: " & Err.Source
Resume Exit_cboClientRecordID_AfterUpdate
End Sub
Great. Well done. You don't need the quotes when passing in a numeric datatype.
ASKER
Using this code:
Open in new window