R
Rich_in_NZ
Hi, (Using Office 2003, but in Access 2000 format)
I have a form that has 14 or so combo-boxes that allow a user to open
another form and filter the records based on their combo-box selections and
clicking the command button. I've had this working perfectly, but have
decided to add in a subform which now contains 5 of the 14 selection fields.
How do I alter the stlinkcriteria to filter the entire form recordset, if a
user chooses to filter by one of the subform fields as well as the parent
form?
Here's a sample of the VBA..
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmQCP"
stLinkCriteria = ""
< this filters the form based on QCP# which is the link field between
the form and subform >
If Not IsNull(Me.cboQCPNum) Then
If stLinkCriteria = "" Then
stLinkCriteria = "[tblQCP]![QCP#] = " & Me.cboQCPNum & ""
Else
stLinkCriteria = stLinkCriteria & " And " & "[tblQCP]![QCP#] = "
& Me.cboQCPNum & ""
End If
End If
I have a form that has 14 or so combo-boxes that allow a user to open
another form and filter the records based on their combo-box selections and
clicking the command button. I've had this working perfectly, but have
decided to add in a subform which now contains 5 of the 14 selection fields.
How do I alter the stlinkcriteria to filter the entire form recordset, if a
user chooses to filter by one of the subform fields as well as the parent
form?
Here's a sample of the VBA..
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmQCP"
stLinkCriteria = ""
< this filters the form based on QCP# which is the link field between
the form and subform >
If Not IsNull(Me.cboQCPNum) Then
If stLinkCriteria = "" Then
stLinkCriteria = "[tblQCP]![QCP#] = " & Me.cboQCPNum & ""
Else
stLinkCriteria = stLinkCriteria & " And " & "[tblQCP]![QCP#] = "
& Me.cboQCPNum & ""
End If
End If