From 490d82eaea90d91fedb394460be92187ed88bcb6 Mon Sep 17 00:00:00 2001 From: bclothier Date: Fri, 20 Oct 2023 11:47:41 -0500 Subject: [PATCH] The AutoClose may run after the form has closed (e.g. if the user is quick to close it) which may result in an error about object members not available. Since the form is closed, there's no point in setting the timer interval. To avoid the error when debugging, we add a IsLoaded check and skip it if it's not loaded. --- Version Control.accda.src/forms/frmVCSMain.bas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Version Control.accda.src/forms/frmVCSMain.bas b/Version Control.accda.src/forms/frmVCSMain.bas index 08f52751..de354f4c 100644 --- a/Version Control.accda.src/forms/frmVCSMain.bas +++ b/Version Control.accda.src/forms/frmVCSMain.bas @@ -2138,7 +2138,13 @@ End Sub '--------------------------------------------------------------------------------------- ' Public Sub AutoClose() - Me.TimerInterval = 2000 + 'The procedure may be called when the form has been closed. + 'In this case, a VBA error may occur, so we check if the + 'form is loaded before setting the property. We do not use + 'the Me.Name because that would be also an error. + If IsLoaded(acForm, "frmVCSMain", False) Then + Me.TimerInterval = 2000 + End If End Sub