Application Echo

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
 
D

Dirk Goldgar

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top