Application Echo

  • Thread starter Thread starter LucB
  • Start date Start date
L

LucB

When the code below is executed (to remove a filter), my form always
displays the first record before jumping to the last. Why doesn't the
'Application.Echo False' prevent that from happening?

Sub FilterOff_Click()
DoCmd.Hourglass True
Application.Echo False

Form.Filter = ""
Form.FilterOn = False

DoCmd.GoToRecord acDataForm, "Accessies", acLast

Application.Echo True
DoCmd.Hourglass False
End Sub
 
LucB said:
When the code below is executed (to remove a filter), my form always
displays the first record before jumping to the last. Why doesn't the
'Application.Echo False' prevent that from happening?

Sub FilterOff_Click()
DoCmd.Hourglass True
Application.Echo False

Form.Filter = ""
Form.FilterOn = False

DoCmd.GoToRecord acDataForm, "Accessies", acLast

Application.Echo True
DoCmd.Hourglass False
End Sub

Maybe you need to wait for the GoToRecord to finish. Try inserting

DoEvents

between the DoCmd.GoToRecord call and Application.Echo True.
 
Back
Top