first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Code: a Delay with DoEvents

'Note that Access Basic does not have a Date data type. 'Dates are stored as double-precision, floating point 'numbers. For more information please see the following 'Microsoft Knowledge Base Articles: 'Q130514: "ACC: Storing, Calculating, and Comparing 'Date/Time Data" 'Q88657: "ACC: Functions for Calculating and Displaying 'Date/Time Values" ' Sub basCountDown (argDate As Variant)

If IsDate(argDate) Then

    Do

        If g_intStopWaiting Then
            Exit Sub
        End If

        DoEvents
    Loop Until Now > argDate
    
Else

    MsgBox "Invalid Date!", 16, "basCountDown Error"
    g_intStopWaiting = True

End If

End Sub ' 'Here is a sample procedure passing an argument 'to this function: ' Function basFreshenData (argStr As String) As Integer

On Error GoTo basFreshenData_Err

g_intIsRunning = True

Select Case argStr
    Case "Weekday"
        g_varReturn = Date + TimeSerial(23, 59, 0)

    Case "Weekend"
        'The last day of current week:
        g_varReturn = Date - Weekday(Date) + 7
        g_varReturn = g_varReturn + TimeSerial(23, 59, 0)

End Select

basFreshenData = True

Forms!frmMain.Caption = "Waiting for " & g_varReturn & "..."

basCountDown (g_varReturn)

'etc....

End Function

' 'Notice how a variant is used to store date values 'in Acces Basic. Also note how no strings are used 'to handle dates. This procedure should be immune 'to regional settings. '

mod date: 1998-11-30T16:59:56.000Z