J
Jado
Hi
my users have asked for a Quick Save Filter function which alows them to
save their current filter and record ID...
i've created this code, which sort of works but after returning to the saved
filter and record an endness loop is created which can only be stopped by
using Ctrl+Alt+Break
the form this code runs on has a subform and the subform has an OnCurrent
event and also some OnEnter events on cirtain fields.
when i've managed to breake the code the code has stopped mainly at the
OnEnter event of the same field.
i've tried adding docmd.CancelEvent statements but no luck yet..!
any idea's on how to fix.....or a workaround would be greate..!
Thanks
Jado
----------------------------------------------------------------------------
----
Function LoadQuickSaveFilter()
If IsNull(tmpFilter) = True Or tmpFilter = "" Then
MsgBox "A Filter must be saved first!" & vbCrLf & _
"Operation Aborted!"
Exit Function
End If
'searches current recordset for stored bookmark record...
' if not found..then removes filter and searches entire db
'Filter is removed but not lost..![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Me.Filter = tmpFilter
Me.FilterOn = True
Me.RecordsetClone.FindFirst "[Tel No]= '" & tmpID & "'"
If Me.RecordsetClone.NoMatch Then
If MsgBox("The record you have marked is not in the current
Filter or no longer exists!" & vbCrLf & _
"Would you like to search the entire database for this
record?" & vbCrLf & "Your current Filter will removed, but not lost!",
vbYesNo) = vbNo Then
Exit Function
Else
Me.FilterOn = False
Me.RecordsetClone.FindFirst "[Tel No]= '" & tmpID & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox " This Record no longer exists!" & vbCrLf & _
"The record may have been deleted!"
If MsgBox("Would you still like to load the
original filter the record used to belong to..?") = vbYes Then
Me.Filter = tmpFilter
Me.FilterOn = True
Exit Function
End If
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
Exit Function
End If
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Function
my users have asked for a Quick Save Filter function which alows them to
save their current filter and record ID...
i've created this code, which sort of works but after returning to the saved
filter and record an endness loop is created which can only be stopped by
using Ctrl+Alt+Break
the form this code runs on has a subform and the subform has an OnCurrent
event and also some OnEnter events on cirtain fields.
when i've managed to breake the code the code has stopped mainly at the
OnEnter event of the same field.
i've tried adding docmd.CancelEvent statements but no luck yet..!
any idea's on how to fix.....or a workaround would be greate..!
Thanks
Jado
----------------------------------------------------------------------------
----
Function LoadQuickSaveFilter()
If IsNull(tmpFilter) = True Or tmpFilter = "" Then
MsgBox "A Filter must be saved first!" & vbCrLf & _
"Operation Aborted!"
Exit Function
End If
'searches current recordset for stored bookmark record...
' if not found..then removes filter and searches entire db
'Filter is removed but not lost..
Me.Filter = tmpFilter
Me.FilterOn = True
Me.RecordsetClone.FindFirst "[Tel No]= '" & tmpID & "'"
If Me.RecordsetClone.NoMatch Then
If MsgBox("The record you have marked is not in the current
Filter or no longer exists!" & vbCrLf & _
"Would you like to search the entire database for this
record?" & vbCrLf & "Your current Filter will removed, but not lost!",
vbYesNo) = vbNo Then
Exit Function
Else
Me.FilterOn = False
Me.RecordsetClone.FindFirst "[Tel No]= '" & tmpID & "'"
If Me.RecordsetClone.NoMatch Then
MsgBox " This Record no longer exists!" & vbCrLf & _
"The record may have been deleted!"
If MsgBox("Would you still like to load the
original filter the record used to belong to..?") = vbYes Then
Me.Filter = tmpFilter
Me.FilterOn = True
Exit Function
End If
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
Exit Function
End If
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Function