Avatar of Lawrence Salvucci
Lawrence Salvucci
Flag for United States of America

asked on 

Close Access Report using the timer

I have some users who have a problem leaving a report opened in Preview mode overnight. Trying to tell them not to do that is like talking to a brick wall sometimes. So what I want to do is have the report close the preview window after a specific amount of time. Can this be done when a report is opened in preview mode? This is how I open the report from my form. This form does stay open but in hidden mode until the user actually closes the report. Then the form is unhidden and they can then close the form also. I want to put a timer on the report so it closes after 5 minutes. So how can I set this up on my report?

Here is the code that opens the report from a command button on my form:

    Dim stDocName As String

    TempVars.Add "strBOForm", Me.Name
    stDocName = Me.cboReport
    DoCmd.OpenReport stDocName, acPreview
    DoCmd.RunCommand acCmdFitToWindow
    Me.Visible = False

Open in new window


And here is the code that unhides the form once the user closes the report preview:

Private Sub Report_Close()
    Forms(TempVars!strBOForm).Visible = True
End Sub

Open in new window

Microsoft Access

Avatar of undefined
Last Comment
Lawrence Salvucci

8/22/2022 - Mon