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.
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.