[RESOLVED] ACCESS - "You cancelled the previous operation"
!!?
i have a form that I am trying to filter according to dropdowns.
I coded it so if you press ESC it clears the combo and resets the filter.
After it gives the error, I can hit F5 and it runs fine. its like it is going to fast?
Private Sub SetFilter()
Dim FLT As String
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is ComboBox Then
If Left(ctl.Name, 2) = "F_" And Not IsNull(ctl.Value) Then
If FLT <> "" Then
FLT = FLT & " AND [" & ctl.Tag & "]='" & ctl.Value & "'"
Else
FLT = "[" & ctl.Tag & "]='" & ctl.Value & "'"
End If
End If
End If
Next
Me.Filter = FLT 'ERRORS HERE <<<<---
Me.FilterOn = True
End Sub
Private Sub F_cbo_Q_Change()
SetFilter
End Sub
Private Sub F_cbo_Q_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then F_cbo_Q.Value = Null: SetFilter
End Sub
Private Sub F_cbo_Stat_Change()
SetFilter
End Sub
Private Sub F_cbo_Stat_KeyPress(KeyAscii As Integer)
If KeyAscii = 27 Then F_cbo_Stat.Value = Null: SetFilter
End Sub
Private Sub F_cbo_Stat_NotInList(NewData As String, Response As Integer)
Debug.Print NewData
End Sub
[1456 byte] By [
Static] at [2007-12-5 11:56:36]

# 1 Re: [RESOLVED] ACCESS - "You cancelled the previous operation"
Real quick, not at work to check, and kind of riffing here since don't use filters much, but maybe use KeyUp instead of KeyPress. Maybe ESC triggers automatic events.
Since FLT is declared in the sub SetFilter, it won't retain it's value between calls. So each cbo event where coded will reset filter. Not sure that's what you want. Also not sure that cbo.value is retained after it's clicked and another one is.
You call SetFilter even if Esc is clicked, but don't check for it in SetFilter. Maybe in the cbo event exit sub for ESC. No need to call it in that case.
What I'm trying to say is that Access is parsing your code and finding the ESC character, and treating it as such.
# 2 Re: [RESOLVED] ACCESS - "You cancelled the previous operation"
well worta worked... the ESC press works to cancel, but now... the click event triggers the error!!. this makes no sense!
If I select the filters in order of the columns.. it works fine. no errors.
but if I select the 3rd, 4th or whatever.. it just errors!! this is driving me nuts!
Static at 2007-12-5 19:39:25 >
