Here's how I did it:
I created a form with the following unbound controls:
[tt] Control Type Name Caption/text
text box txtUpdateTime default=time()
Command Button cmdSchedule &Schedule Update
Command Button cmdCancel &Cancel
Label lblMessage -blank-
Label lblFinish -blank-
[/tt]
Set the command button OnClick Events to Event Procedure.
Enter the following code:
Private Sub cmdCancel_Click()
If cmdSchedule.Enabled = False Then
cmdSchedule.Enabled = True
lblMessage.Caption = "Scheduled update canceled"
lblFinish.Caption = ""
txtUpdateTime.Enabled = True
Me.TimerInterval = 0
Else
DoCmd.Close
End If
End Sub
Private Sub cmdSchedule_Click()
If IsNull(txtUpdateTime) Then
MsgBox "Enter time to begin update."
Exit Sub
End If
'My macro runs some queries that hit linked tables that are in Oracle databases that require a login/password.
'So I open one and close one table from each db to get the user to login.
'Open the Circuits table to establish connection to Oracle DB1, then close
DoCmd.OpenTable "linked oracle table name"
DoCmd.Close acTable, "linked oracle table name", acSaveNo
'Open Job_Steps table to establish connection to Oracle db2, then close
DoCmd.OpenTable "Linked Oracle Table Name"
DoCmd.Close acTable, "Linked Oracle Table Name", acSaveNo
Me.TimerInterval = 60000
lblMessage.Caption = "Update will begin at " & Format(txtUpdateTime, "Medium Time"

lblFinish.Caption = ""
txtUpdateTime.Enabled = False
cmdCancel.SetFocus
cmdSchedule.Enabled = False
Dim sTo As String 'Mailing list
Dim sSub As String 'Text to appear in the subject line
Dim sMsgText As String 'Text to appear in the message
sTo = "username1; username2; username3"
sSub = "Process Schedule Notification Subject Line"
sMsgText = "Process has been scheduled to begin at " & Format(txtUpdateTime, "Medium Time"
DoCmd.SendObject , , , sTo, , , sSub, sMsgText, False
MsgBox "Process schedule notification has been sent."
lblFinish.Caption = "Do not close this database or shutdown the computer. This will cancel the scheduled update." '"Closing this database or shutting down the computer will cancel the scheduled update."
lblFinish.ForeColor = vbRed
End Sub
Private Sub Form_Timer()
If Format(txtUpdateTime, "Medium Time"

= Format(Time(), "Medium Time"

Then
Me.TimerInterval = 0
lblMessage.Caption = "Update began at " & Time()
'Run the scheduled procedure
DoCmd.RunMacro "macUpdateOrderStatus"
lblFinish.ForeColor = vbBlack
lblFinish.Caption = "Updated completed at " & Time()
txtUpdateTime.Enabled = True
txtUpdateTime = Null
cmdSchedule.Enabled = True
Notification
End If
End Sub
Private Sub Notification()
Dim sTo As String 'Mailing list
Dim sSub As String 'Text to appear in the subject line
Dim sMsgText As String 'Text to appear in the message
sTo = "username1; username2, username3"
sSub = "Notification email subject"
sMsgText = "Process was completed at " & Format(Time(), "Medium Time"
DoCmd.SendObject , , , sTo, , , sSub, sMsgText, False
End Sub
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!