UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Wait until the specified date and time before exiting    
 
   
Candace Tripp
post May 31 2002, 08:22 AM
Post#1


UA Admin & Utter Angel
Posts: 3,039
Joined: 30-January 00
From: Virginia, USA


Comments
This function can be useful if you want to programmatically defer an action until a later time. For example, you could call this code to wait until 1:00am in the morning and perform a data backup at that time.

Example
Sub LateBackup ()
' ==============================================
' Example code for WaitForTime()
' ----------------------------------------------
' Waits until 11:00 pm and then archives a
' table called Customers to a database called
' C:\BACKUP.MDB.
' ==============================================
Dim datTime As Date

' Get a date value equivalent to today at 11:00pm
datTime = CDate(Date & " 11:00 PM")

' Wait for the appointed time
Call WaitForTime(datTime)

Docmd.TransferDatabase acExport, "Microsoft Access", "c:\BACKUP.MDB", acTable, "Customers", "Customers"

End Sub



Sub WaitForTime(datDate As Date)
' Comments : Waits until the specified date and time before exiting
' Parameters: datDate - date/time to wait for
' Returns : None
'
Do
' Yield to other programs
DoEvents
Loop Until Now >= datDate

End Sub
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    17th December 2017 - 03:15 AM