I do this quite a bit. 
 
The "Run" line on my Task Scheduler is something like this:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "\\fs1\share\PrestressLabor\PrestressLabor2003.mde" /cmd exportetime
 
The bold part at the end is the command.
 
In my AutoExec routine, I do this:
 
'***** code start *****'
    '-- passed argument --'
    g_strCommand = Command
   
    '-- numerous automatic procedures designed to run via Windows Task Scheduler --'
    '-- set g_blnSilentError = True to turn off msgbox in error handler --'

    If g_strCommand = "webexport" Or g_strCommand = "webexportmonday" Then
        g_blnSilentError = True
        ExportLaborReports
        GoTo EXITROUTINE
    ElseIf g_strCommand = "printtimesheet" Then
        g_blnSilentError = True
        PrintTimesheets
        GoTo EXITROUTINE
    ElseIf g_strCommand = "exporttimesheet" Then
        g_blnSilentError = True
        ExportTimesheets
        GoTo EXITROUTINE
    ElseIf g_strCommand = "wbscomplete" Then
        g_blnSilentError = True
        SendWBSCompletionEmail
        GoTo EXITROUTINE
    ElseIf g_strCommand = "exportetime" Then
        g_blnSilentError = True
        ImportETime
        GoTo EXITROUTINE
    End If
'***** code end *****'
 
There are a handful of automatic routines we run.  It's important to note that:
 
1) mapped drives won't work if you're running this at night when the specified "Run As" user is not legitimately logged on (i.e. use UNC to link your tables).
2) if you have error-handling in place, associated messageboxes will cause your routine to hang.  I utilize a global variable called "g_blnSilentError" that my error handler uses to determine whether it should raise a msgbox.
 
Assigning the Command to a global variable is not necessary, but I do it for error logging purposes.
 

Tom Oakes
Personal PC Consultants, Inc.
[EMAIL PROTECTED]
503.230.0911 (O)
402.968.6946 (C)
734.264.0911 (F)




From: AccessDevelopers@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Toby Bierly
Sent: Monday, January 16, 2006 11:32 AM
To: AccessDevelopers@yahoogroups.com
Subject: [AccessDevelopers] Starting a specific form when opening Access

I have a backend database that I normally want a form basically saying "you shouldn't be in this database" with only a button to exit the database to show up.  I have this set as my startup form.  This works fine.
 
Now I want to make another form that will just update a couple tables and I can call with the Task Scheduler.
 
I know I've seen a way to open a specific form using the command line, but I can't seem to find it right now.
 
Can anyone save me some time searching for it?
 
Thanks,
Toby



Please zip all files prior to uploading to Files section.




SPONSORED LINKS
Microsoft access developer Microsoft access help Microsoft access database
Microsoft access training Microsoft access training course Microsoft access programming


YAHOO! GROUPS LINKS




Reply via email to