Form alert

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mabsalam
    New Member
    • Aug 2014
    • 7

    #1

    Form alert

    I want my form to generate more the than an alert with different time interval. For Example I want my form to open a report after every 30sec and open another report after 1min interval.
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3665

    #2
    mabsalam,

    I am assuming open one report at 0:30, the other report at 1:00 and then the first report at 1:30?

    One way is to have a class-specific boolean variable decalredin teh top section of your form's VBA (such as fReport). When the form opens set that variable to false (it will be by default).

    Set the timer interval for 30 seconds (30,000). Then, something like this:

    Code:
    Private Sub Form_Timer()
    On Error GoTo EH
        If fReport Then
            DoCmd.OpenReport "ReportA"
        Else
            DoCmd.OpenReport "ReportB"
        End If
        fReport = Not fReport
        Exit Sub
    EH:
        MsgBox "There was an error opening the report!  " & _
            "Please contact your Database Administrator.", vbCritical, "Error!"
        Exit Sub
    End Sub
    Hope this helps!

    Comment

    Working...