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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

outputto error in mde

Status
Not open for further replies.

cneill

Instructor
Mar 18, 2003
210
GB
I have the following code for a comand button, works find when Database is in MDB format but get an error when in MDE format, I am using Access 2002

'Export File Code
Dim strPathFile As String, strFile As String, strPath As String
Dim strRpt As String, strBrowseMsg As String, strQuery As String
Dim blnHasFieldNames As Boolean
Dim sTm As Date
Dim varStatus As Variant
Dim strStatus As String

strStatus = "The database is Exporting the New file....."
varStatus = SysCmd(acSysCmdSetStatus, strStatus)

strBrowseMsg = "Select the folder where you wish the new EXCEL file to be created:"

strPath = BrowseFolder(strBrowseMsg)

If strPath = "" Then
MsgBox "No folder was selected.", vbOK, "No Selection"
Exit Sub
End If

' Replace filename.xls with the real name of the EXCEL file
' that is to be created and into which the data are to be
' exported
strFile = "CESP Weekly Report Summary.xls"

' Replace tablename with the real name of the table from which
' the data are to be exported

strRpt = "RptCESPWeeklySummary"

strPathFile = strPath & "\" & strFile


DoCmd.OutputTo acReport, strRpt, acSpreadsheetTypeExcel9, strPathFile



strStatus = "The database has Finished Exporting the New file....."
varStatus = SysCmd(acSysCmdSetStatus, strStatus)

MsgBox ("The CESP Weekly Report Summary has been created and saved in Folder " & strPathFile & ""), vbInformation, "Hi Just to let you know"

' Replace filename.xls with the real name of the EXCEL file
' that is to be created and into which the data are to be
' exported
strFile = "CESP Weekly KPI Summary.xls"

' Replace tablename with the real name of the table from which
' the data are to be exported

strQuery = "QryCESPWeeklySummary"

strPathFile = strPath & "\" & strFile


DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, strQuery, strPathFile


MsgBox ("The CESP Weekly KPI Summary has been created and saved in Folder " & strPathFile & ""), vbInformation, "Hi Just to let you know"

Any Ideas
 
Which error ?
On which line of code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi PHV

When I compile the code in MDB it is fine, after I convert to MDE
I just get the following message OutputTo isn't avaiable now.

So I am not really sure where the error is.

Any Thoughts

Thanks

CNEIL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top