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