Task Scheduler

  • Thread starter Janet Barnett via AccessMonster.com
  • Start date
J

Janet Barnett via AccessMonster.com

On XP SP2 machine, I'm trying to get an Access DB to open automatically
every day at a set time. Here's the syntax I got from:
http://support.microsoft.com/?id=210111

myTest.bat is the following:
c:
cd\Program Files\Microsoft Office\Office10\MSACCESS.exe f:\APPS95\List\
listAuto.mdb

Task Scheduler set to execute myTest.bat

Nothing happens. Tried putting quotes around directories with spaces.
Tried taking out the onOpen, and executing a Macro appending " /x Macro1"
above. Nothing.

Yet the same account is using the Task Scheduler to copy files across the
network every two minutes and it's working fine.

I've got the start-up options set to open a form which fires the event
onOpen which does the following (and if I manually open the mdb, everything
works fine):

Dim strFileName As String
strFileName = "f:\apps95\list\fhc" & Format$(Date, "mm-dd-yy") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8,
"qryFHCxlsRpt", strFileName, True, ""

Dim strTo As String
Dim strCC As String
Dim strSubject As String
Dim strMsg As String
strMsg = "Detailed summary report for the following docs: " & vbCrLf

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select Nz([REGULAR-MD], 'Unknown Doc') from qryFHCxlsRpt",
CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
strMsg = strMsg & rs.GetString(adClipString)

strTo = "(e-mail address removed)"
strSubject = "FHC text"
strCC = ""
DoCmd.SendObject acSendReport, "Family Practice Service Detailed
Report", "Snapshot Format", strTo, strCC, , strSubject, strMsg, False

rs.Close

I'm very new to this, so if anyone has any ideas or a better way to do
this, I'd appreciate it.
 
D

Dirk Goldgar

Janet Barnett via AccessMonster.com said:
On XP SP2 machine, I'm trying to get an Access DB to open
automatically every day at a set time. Here's the syntax I got from:
http://support.microsoft.com/?id=210111

myTest.bat is the following:
c:
cd\Program Files\Microsoft Office\Office10\MSACCESS.exe
f:\APPS95\List\ listAuto.mdb

Task Scheduler set to execute myTest.bat

Nothing happens. Tried putting quotes around directories with spaces.
Tried taking out the onOpen, and executing a Macro appending " /x
Macro1" above. Nothing.

Yet the same account is using the Task Scheduler to copy files across
the network every two minutes and it's working fine.

I've got the start-up options set to open a form which fires the event
onOpen which does the following (and if I manually open the mdb,
everything works fine):

Dim strFileName As String
strFileName = "f:\apps95\list\fhc" & Format$(Date, "mm-dd-yy") &
".xls" DoCmd.TransferSpreadsheet acExport,
acSpreadsheetTypeExcel8, "qryFHCxlsRpt", strFileName, True, ""

Dim strTo As String
Dim strCC As String
Dim strSubject As String
Dim strMsg As String
strMsg = "Detailed summary report for the following docs: " &
vbCrLf

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "select Nz([REGULAR-MD], 'Unknown Doc') from
qryFHCxlsRpt", CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
strMsg = strMsg & rs.GetString(adClipString)

strTo = "(e-mail address removed)"
strSubject = "FHC text"
strCC = ""
DoCmd.SendObject acSendReport, "Family Practice Service Detailed
Report", "Snapshot Format", strTo, strCC, , strSubject, strMsg, False

rs.Close

I'm very new to this, so if anyone has any ideas or a better way to do
this, I'd appreciate it.

I posted an answer in the .formscoding newsgroup, where you
independently posted the same question. That's called "multiposting",
and it's generally frowned on because others don't know what answers
have already been given, and so they duplicate the effort. Also it's
harder for you to keep track of the various replies, and it's harder for
later readers of the question, who may be looking for the same answer,
to learn what they need.

In most cases a single, well-chosen newsgroup will do. If your question
really is relevant to more than one newsgroup, the approved technique is
to "crosspost" it instead, by listing multiple newsgroups in the To: or
Newsgroups: line of a single message. If you do that, the message and
any replies will appear in all the listed newsgroups automatically,
which is beneficial to all concerned.
 
P

Paul Overway

Why use a BAT file at all? Open the advanced properties for the task and
set Run to:

"C:\Program Files\Microsoft Office\Office10\MSACCESS.exe"
"f:\APPS95\List\listAuto.mdb" /x Macro1

You should make sure you have adequate error handling and that the routine
does in fact run correctly (without any user intervention!) before setting
up the scheduled task. But I suspect the problem is that you're trying to
send mail...and intervention is necessary to handle the prompts about
sending mail OR you need to use something like Redemption, ClickYes,
whatever that will allow sending mail without prompts.
 
J

Janet Barnett via AccessMonster.com

Dirk,
I'm so sorry. It wasn't intential, but a mistake. I'll be more careful in
the future and try to ensure it doesn't happen again. Thanks for the reply
to the other post.
JB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Getrows array 3
Task Scheduler 5
dao recordset error 3
Recordset getRows to string 6
Email Body Blank 1
Send Individual reports with Jmail loop 1
Email endless loop 4
Sending report as HTML Body of e-mail 1

Top