zimmer9
asked on
How to prevent getting a Runtime Error '-2147467259 Not Enough Disk Space when executing rs.Open "SELECT tblCostCenter.[COSTCENTER] FROM tblCostCenter GROUP BY tblCostCenter.[COSTCENTER];", c ?
Public Function prtFaLedgerExcel()
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim fname As String
Dim sql As String
Dim fpath As String
Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset
fpath = "C:\FALEDGER\REPORTS\OUTPU TS\"
MsgBox ("The process of conversion FA Ledger Report to excel format is started. Please wait ... ")
'1. Open cost center table and pass cost center as a parameter
rs.Open "SELECT tblCostCenter.[COSTCENTER] FROM tblCostCenter GROUP BY tblCostCenter.[COSTCENTER] ;", cn
Do Until rs.EOF
fname = fpath & "fa_ledger_report" & "_" & rs("COSTCENTER") & ".xls"
'2. insert records to tblFaLedgerBranch only for selected cost center
sql = "INSERT INTO tblFaLedgerBranch ( COSTCENTER, SAR_CATEGORY, ASSET_NUMBER, ASSET_DESC, VENDOR_NAME, INVOICE_NUMBER, BOOK_COST, BOOK_ACCUM_DEPR, CURR_DEPR, YTD_DEPR, NET_BOOK_VALUE, BEGIN_DEPR, DEPR_METHOD_CODE, DEPR_LIFE, LOCATION_ID, DESCRIPTION, ADDRESS2, CITY, STATE, ZIP,REPORT_RUN_DATE,COMMEN TS )" & _
"SELECT COSTCENTER, SAR_CATEGORY, ASSET_NUMBER, ASSET_DESC, VENDOR_NAME, INVOICE_NUMBER, BOOK_COST, BOOK_ACCUM_DEPR, CURR_DEPR, YTD_DEPR, NET_BOOK_VALUE, BEGIN_DEPR, DEPR_METHOD_CODE, DEPR_LIFE, " & _
"LOCATION_ID , Description, ADDRESS2, CITY, State, ZIP, REPORT_RUN_DATE, '' " & _
"FROM dbo_FA_LEDGER_LOCATION " & _
"WHERE (dbo_FA_LEDGER_LOCATION.CO STCENTER = '" & rs(0) & "')"
DoCmd.SetWarnings False
DoCmd.RunSQL sql
'3. Convert query to excel format
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Fa_ledger_report", fname, True
'4. Drop temp table
sql = "DELETE tblFaLedgerBranch FROM tblFaLedgerBranch"
DoCmd.RunSQL sql
sql = ""
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set cn = Nothing
Dim rs As ADODB.Recordset
Dim cn As ADODB.Connection
Dim fname As String
Dim sql As String
Dim fpath As String
Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset
fpath = "C:\FALEDGER\REPORTS\OUTPU
MsgBox ("The process of conversion FA Ledger Report to excel format is started. Please wait ... ")
'1. Open cost center table and pass cost center as a parameter
rs.Open "SELECT tblCostCenter.[COSTCENTER]
Do Until rs.EOF
fname = fpath & "fa_ledger_report" & "_" & rs("COSTCENTER") & ".xls"
'2. insert records to tblFaLedgerBranch only for selected cost center
sql = "INSERT INTO tblFaLedgerBranch ( COSTCENTER, SAR_CATEGORY, ASSET_NUMBER, ASSET_DESC, VENDOR_NAME, INVOICE_NUMBER, BOOK_COST, BOOK_ACCUM_DEPR, CURR_DEPR, YTD_DEPR, NET_BOOK_VALUE, BEGIN_DEPR, DEPR_METHOD_CODE, DEPR_LIFE, LOCATION_ID, DESCRIPTION, ADDRESS2, CITY, STATE, ZIP,REPORT_RUN_DATE,COMMEN
"SELECT COSTCENTER, SAR_CATEGORY, ASSET_NUMBER, ASSET_DESC, VENDOR_NAME, INVOICE_NUMBER, BOOK_COST, BOOK_ACCUM_DEPR, CURR_DEPR, YTD_DEPR, NET_BOOK_VALUE, BEGIN_DEPR, DEPR_METHOD_CODE, DEPR_LIFE, " & _
"LOCATION_ID , Description, ADDRESS2, CITY, State, ZIP, REPORT_RUN_DATE, '' " & _
"FROM dbo_FA_LEDGER_LOCATION " & _
"WHERE (dbo_FA_LEDGER_LOCATION.CO
DoCmd.SetWarnings False
DoCmd.RunSQL sql
'3. Convert query to excel format
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Fa_ledger_report", fname, True
'4. Drop temp table
sql = "DELETE tblFaLedgerBranch FROM tblFaLedgerBranch"
DoCmd.RunSQL sql
sql = ""
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
Set cn = Nothing
ASKER
The mdb is 177 MB (186,339,328 bytes)
zimmer9,
... and I assume that you DO have plenty of disc space, yes?
Pete
... and I assume that you DO have plenty of disc space, yes?
Pete
ASKER
19GB USED SPACE
18GB FREE SPACE
18GB FREE SPACE
ASKER
I closed down the application and reran it.
This time the compiler is hightlighting in yellow the following command:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Fa_ledger_report", fname, True
and I get the same error as follows
Runtime Error '-2147467259 Not Enough Disk Space
This time the compiler is hightlighting in yellow the following command:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Fa_ledger_report", fname, True
and I get the same error as follows
Runtime Error '-2147467259 Not Enough Disk Space
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Verify that you are not hitting the MSaccess Limits.
Make a copy of your DB and replace the one you are using presently or create a new DB and import your tables into the new DB
Ab
Make a copy of your DB and replace the one you are using presently or create a new DB and import your tables into the new DB
Ab
You could try this - it looks like it might be relevant :
http://support.microsoft.com/?id=286153
Pete
http://support.microsoft.com/?id=286153
Pete
Would you post the solution you found please, so that others might benefit.
Pete
Pete
How big is your mdb file?
Pete