S
Sean
Hey all,
I've been having an issue with a form I'm trying to run a filter on.
I've looked all over this newsgroup and can't seem to find the right
answer to solve my problem, so I've resorted to actually post!
Below is the code I'm having trouble with. The form has four combo
boxes that allow the user to filter the data on the form. Once a combo
box is updated, the appropriate sub below is called and sets the string
in the FilterArray. All four filters should work the same. However,
when I try to filter using cboFindTermBlock I get the following error:
Run-time error '2001':
You canceled the previous operation.
which debugs at the following line of code:
Me.Filter = strFilter
The other three filters all work perfectly. I should note that the
data in the cboFindTermBlock combo box is populated from a query that
splits a longer string into pieces, i.e. TB102-14 (text) becomes TB102
in the query.
I've checked the data types on all the combo boxes and they all contain
text, so I'm really at a loss to try to figure this thing out. Any
help is greatly appreciated!!!
---------------------------------------------------------------------------------------------
Private Sub cboFindCabinet_AfterUpdate()
i = cboFindCabinet.ListIndex
If i = -1 Then Exit Sub
FilterArray(1) = "[CAB_MMOD] = '" & cboFindCabinet & "'"
FilterDetails
End Sub
Private Sub cboFindTermBlock_AfterUpdate()
i = cboFindTermBlock.ListIndex
If i = -1 Then Exit Sub
FilterArray(2) = "[TermBlock] = '" & cboFindTermBlock.Value & "'"
FilterDetails
End Sub
Private Sub cboFindCableNum_AfterUpdate()
i = cboFindCableNum.ListIndex
If i = -1 Then Exit Sub
FilterArray(3) = "[Cable_Num] = '" & cboFindCableNum & "'"
FilterDetails
End Sub
Private Sub cboFindSystem_AfterUpdate()
i = cboFindSystem.ListIndex
If i = -1 Then Exit Sub
FilterArray(4) = "[SystemAlt] = '" & cboFindSystem & "'"
FilterDetails
End Sub
Private Sub FilterDetails()
Dim strFilter
strFilter = "("
strFilter = strFilter & FilterArray(1)
If FilterArray(2) <> "" Then strFilter = strFilter & " AND " &
FilterArray(2)
If FilterArray(3) <> "" Then strFilter = strFilter & " AND " &
FilterArray(3)
If FilterArray(4) <> "" Then strFilter = strFilter & " AND " &
FilterArray(4)
strFilter = Replace(strFilter, "( AND ", "(") & ")"
strFilter = Replace(strFilter, "()", "")
strFilter = strFilter
Me.Filter = strFilter
Me.FilterOn = True
End Sub
---------------------------------------------------------------------------------------------
I've been having an issue with a form I'm trying to run a filter on.
I've looked all over this newsgroup and can't seem to find the right
answer to solve my problem, so I've resorted to actually post!
Below is the code I'm having trouble with. The form has four combo
boxes that allow the user to filter the data on the form. Once a combo
box is updated, the appropriate sub below is called and sets the string
in the FilterArray. All four filters should work the same. However,
when I try to filter using cboFindTermBlock I get the following error:
Run-time error '2001':
You canceled the previous operation.
which debugs at the following line of code:
Me.Filter = strFilter
The other three filters all work perfectly. I should note that the
data in the cboFindTermBlock combo box is populated from a query that
splits a longer string into pieces, i.e. TB102-14 (text) becomes TB102
in the query.
I've checked the data types on all the combo boxes and they all contain
text, so I'm really at a loss to try to figure this thing out. Any
help is greatly appreciated!!!
---------------------------------------------------------------------------------------------
Private Sub cboFindCabinet_AfterUpdate()
i = cboFindCabinet.ListIndex
If i = -1 Then Exit Sub
FilterArray(1) = "[CAB_MMOD] = '" & cboFindCabinet & "'"
FilterDetails
End Sub
Private Sub cboFindTermBlock_AfterUpdate()
i = cboFindTermBlock.ListIndex
If i = -1 Then Exit Sub
FilterArray(2) = "[TermBlock] = '" & cboFindTermBlock.Value & "'"
FilterDetails
End Sub
Private Sub cboFindCableNum_AfterUpdate()
i = cboFindCableNum.ListIndex
If i = -1 Then Exit Sub
FilterArray(3) = "[Cable_Num] = '" & cboFindCableNum & "'"
FilterDetails
End Sub
Private Sub cboFindSystem_AfterUpdate()
i = cboFindSystem.ListIndex
If i = -1 Then Exit Sub
FilterArray(4) = "[SystemAlt] = '" & cboFindSystem & "'"
FilterDetails
End Sub
Private Sub FilterDetails()
Dim strFilter
strFilter = "("
strFilter = strFilter & FilterArray(1)
If FilterArray(2) <> "" Then strFilter = strFilter & " AND " &
FilterArray(2)
If FilterArray(3) <> "" Then strFilter = strFilter & " AND " &
FilterArray(3)
If FilterArray(4) <> "" Then strFilter = strFilter & " AND " &
FilterArray(4)
strFilter = Replace(strFilter, "( AND ", "(") & ")"
strFilter = Replace(strFilter, "()", "")
strFilter = strFilter
Me.Filter = strFilter
Me.FilterOn = True
End Sub
---------------------------------------------------------------------------------------------