Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Task Scheduler and Access 1

Status
Not open for further replies.

janetb99

Programmer
Joined
May 8, 2003
Messages
15
Location
US
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:
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 = "janetb@mtn.ncahec.org"
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.
 
And this ?
"c:\Program Files\Microsoft Office\Office10\MSACCESS.exe" f:\APPS95\List\listAuto.mdb /x Macro1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for the help. Sorry to be so slow, it's my first time at this sort of thing. That did the trick and everything's ducky now.

Janet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top