ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   why am I getting a 3010 error? (https://www.excelbanter.com/excel-programming/342461-why-am-i-getting-3010-error.html)

Andy Dorph

why am I getting a 3010 error?
 
The following code works until I get to the DoCmd.TransferSpreadsheet line.
I have confirmed that the table, TempTable, is deleted and then generated.
Thanks in advance. I have another module, from which i created this one thru
cut and paste (which DOES NOT have the DoCmd.DeleteObject command, that works
perfectly. What am I doing wrong?

Thanks in advance.

DoCmd.DeleteObject acTable, "TempTable"

strSheetQuery = "SELECT T_FY AS [Fiscal Year], P_FUND AS FUND, P_BORG AS
BORG, P_NAME AS [Project Name], T_CORG AS CORG, T_BOC AS BOC, BOC.Description
AS [BOC Description], T_Quarter AS Quarter, IIF((T_Type='1' OR T_Type =
'2'),T_Amount,0) AS ALLOCATION, IIF(T_Type='C',T_Amount,0) AS PLANNED,
IIF(T_Type='O',T_Amount,0) AS OBLIGATION, T_Description AS Description,
T_DocumentNumber AS [Document Number], T_DocumentDate AS [Document Date],
T_Type AS Type " & _
"INTO TempTable " & _
"FROM BOC INNER JOIN (Projects INNER JOIN [Transaction] ON Projects.P_ID
= Transaction.T_Project) ON BOC.BOC = Transaction.T_BOC " & _
"WHERE Transaction.T_Closed = False AND " & _
"T_Project = " & strProject & _
" ORDER BY T_FY & T_Project & T_BOC & T_Quarter & T_Type & T_DocumentDate"

DoCmd.RunSQL (strSheetQuery)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"TempTable", Application.CurrentProject.Path & "\TempSheet", True


JNW

why am I getting a 3010 error?
 
Andy,

I found the following explanation for the 3010 error on the microsoft website:

"You are attempting to add a file which is already listed as part of the
component. You can publish a file into a given component only once."\

Hope that helps


"Andy Dorph" wrote:

The following code works until I get to the DoCmd.TransferSpreadsheet line.
I have confirmed that the table, TempTable, is deleted and then generated.
Thanks in advance. I have another module, from which i created this one thru
cut and paste (which DOES NOT have the DoCmd.DeleteObject command, that works
perfectly. What am I doing wrong?

Thanks in advance.

DoCmd.DeleteObject acTable, "TempTable"

strSheetQuery = "SELECT T_FY AS [Fiscal Year], P_FUND AS FUND, P_BORG AS
BORG, P_NAME AS [Project Name], T_CORG AS CORG, T_BOC AS BOC, BOC.Description
AS [BOC Description], T_Quarter AS Quarter, IIF((T_Type='1' OR T_Type =
'2'),T_Amount,0) AS ALLOCATION, IIF(T_Type='C',T_Amount,0) AS PLANNED,
IIF(T_Type='O',T_Amount,0) AS OBLIGATION, T_Description AS Description,
T_DocumentNumber AS [Document Number], T_DocumentDate AS [Document Date],
T_Type AS Type " & _
"INTO TempTable " & _
"FROM BOC INNER JOIN (Projects INNER JOIN [Transaction] ON Projects.P_ID
= Transaction.T_Project) ON BOC.BOC = Transaction.T_BOC " & _
"WHERE Transaction.T_Closed = False AND " & _
"T_Project = " & strProject & _
" ORDER BY T_FY & T_Project & T_BOC & T_Quarter & T_Type & T_DocumentDate"

DoCmd.RunSQL (strSheetQuery)
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel7,
"TempTable", Application.CurrentProject.Path & "\TempSheet", True



All times are GMT +1. The time now is 12:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com