SmartCarFun
Registered User.
- Local time
- Today, 23:16
- Joined
- Feb 17, 2012
- Messages
- 25
Code:
Private Sub cboTeam_AfterUpdate()
' Update the row source of the cboProducts combo box
' when the user makes a selection in the cboCategories
' combo box.
Me.cboUser.RowSource = "SELECT User1Name FROM" & _
" Users WHERE Region = " & Chr(34) & Me.cboTeam & Chr(34) & _
" ORDER BY User1Name"
Me.cboUser = Me.cboUser.ItemData(0)
SetFilter1
End Sub
Private Sub SetFilter1()
Dim strFilter As String
If Not IsNull(Me.cboTeam) Then
strFilter = strFilter & " AND Team = " & Chr(34) & Me.cboTeam & Chr(34)
End If
If strFilter = "" Then
Me.FilterOn = False
Else
Me.Filter = Mid(strFilter, 6)
Me.FilterOn = True
End If
End Sub
Private Sub cboUser_AfterUpdate()
SetFilter2
End Sub
Private Sub SetFilter2()
Dim strFilter As String
If Not IsNull(Me.cboTeam) Then
strFilter = strFilter & " AND Team = " & Chr(34) & Me.cboTeam & Chr(34)
End If
If Not IsNull(Me.cboUser) Then
strFilter = strFilter & " AND Assigned = " & Me.cboUser
End If
If strFilter = "" Then
Me.FilterOn = False
Else
Me.Filter = Mid(strFilter, 6)
Me.FilterOn = True
End If
End Sub
I have continuous form & 2 x combo boxes, cboTeam & cboUser
1st bit of code allows section of the team by cboTeam, then filters cboUser with members of that team, then fiters the form on cboTeam alone.
2nd bit of code should then filtre on both combo boxes.
1st combo works fine...
2nd combo gives 3075 error (unless empty) and debug points to Me.Filter = Mid(strFilter, 6)
if i change
strFilter = strFilter & " AND Assigned = " & Me.cboUser
to
strFilter = strFilter & " AND Assigned = " & Chr(34) & Me.cboUser & Chr(34)
I get 3464 error
Thanks very much for any help I've been at this for days!!!! and I'm sure it's just something small