hockeyfan21
Registered User.
- Local time
- Today, 15:46
- Joined
- Aug 31, 2011
- Messages
- 38
HI, apologies if my post appears twice, I did not see where my first one got posted.
I have a form with 3 combo boxes that filter another form/report. The first combo (cboByCategory) contains options from 2 different fields within the same table. Before I added this add'l piece of code, all 3 combos worked fine. I am not getting error messages, it just does not filter on the other 2 combo boxes - cboDiv and cboGender.
Would appreciate someone taking a look and letting me know where my syntax could be off.
Thank you!
I have a form with 3 combo boxes that filter another form/report. The first combo (cboByCategory) contains options from 2 different fields within the same table. Before I added this add'l piece of code, all 3 combos worked fine. I am not getting error messages, it just does not filter on the other 2 combo boxes - cboDiv and cboGender.
Would appreciate someone taking a look and letting me know where my syntax could be off.
Code:
Private Sub cmdModifyRecords_Click()
On Error GoTo Err_cmdModifyRecords_Click
Dim stDocName As String
Dim strFilter As String
Dim stLinkCriteria As String
stDocName = "Modify_OpenItems"
'9/5/14 thart updated to allow selection of all Divisions
If IsNull(cboDiv) And IsNull(cboGender) Then
[B]stLinkCriteria = "[Category]= '" & Me.cboByCategory & "' OR [ProdtSubCatLongDesc]='" & Me.cboByCategory & "'"[/B]
ElseIf IsNull(cboGender) Then
stLinkCriteria = "[Category]= '" & Me.cboByCategory & "' OR [ProdtSubCatLongDesc]='" & Me.cboByCategory & "' AND [Division]= '" & Me.cboDiv & "'"
ElseIf IsNull(cboDiv) Then
stLinkCriteria = "[Category]= '" & Me.cboByCategory & "' OR [ProdtSubCatLongDesc]='" & Me.cboByCategory & "' AND [Gender]= '" & Me.cboGender & "'"
Else: stLinkCriteria = "[Category]= '" & Me.cboByCategory & "' OR [ProdtSubCatLongDesc]='" & Me.cboByCategory & "' AND [Division]= '" & Me.cboDiv & "' AND [Gender]= '" & Me.cboGender.Column(1) & "'"
End If
Me.txtRecordCount.Value = DCount("[ASR User Id]", "LateAdds_Current", stLinkCriteria)
If Me.txtRecordCount.Value = 0 Then
MsgBox "No records available for the selections made", vbOKOnly
Else: DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
Exit_cmdModifyRecords_Click:
'
Exit Sub
Err_cmdModifyRecords_Click:
MsgBox Err.Description
Resume Exit_cmdModifyRecords_Click
End Sub
Thank you!