Consulting

Results 1 to 3 of 3

Thread: Application.Echo / DoCmd.Echo resets when Form is closed

  1. #1

    Application.Echo / DoCmd.Echo resets when Form is closed

    I have VBA code to close 3 Forms after clicking a Command Button. The Forms close just fine, but there is a lot of flickering while they close so I wanted to turn off the screen updating using Application.Echo or DoCmd.Echo. However, once any of the Forms close, it appears the screen updating setting resets. How can I get the .Echo to remain in place while all the Forms close?

    DoCmd.Echo False
    
        If CurrentProject.AllForms("Form_1").IsLoaded Then
            DoCmd.RunCommand acCmdSaveRecord
            DoCmd.Close
        End If
        
        If CurrentProject.AllForms("Form_2").IsLoaded Then
            DoCmd.RunCommand acCmdSaveRecord
            DoCmd.Close
        End If
    
        If CurrentProject.AllForms("Form_3").IsLoaded Then
            DoCmd.RunCommand acCmdSaveRecord
            DoCmd.Close
        End If
    
    DoCmd.Echo True
    Note, I've tried this in the Click, Mouse Down, and Mouse Up Events of the Command Button.

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    I have never used the Echo function while closing Forms and do not know why it would reset after a form is closed.
    To overcome the problem I think I would add the Domcd.Echo False within each of the If/End If groups.
    You also should not need to force a save record when closing a form, Access normally does it automatically.

  3. #3
    Thanks OBP, I changed the code to the following since I don't need to check if they're open, I know they're open. Runs much smoother now.

        DoCmd.Echo False
        DoCmd.Close acForm, "Form 1"
        DoCmd.Echo False
        DoCmd.Close acForm, "Form 2"
        DoCmd.Echo False
        DoCmd.Close acForm, "Form 3"
        DoCmd.Echo True

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •