473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Exporting more than 65536 records to excel from access table

aryanraj
Hi all,

I wanted to export around 300000 records that are present in my MS Access 2003 version table to excelsheet version8.
I had written a code to export to multiple sheets in one workbook, but i failed to export the continous records.
The code is exporting only the first 65536 records to multiple sheets.
I want to find a way for this.
--I tried to include an auto number field to my table but it was not successful.
--I tried to give range to export but it is not supported.
Code: ( text )
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database 
  2.  
  3. Dim i As Long 
  4.  
  5. Dim ren, old As String 
  6.  
  7. Dim n As Integer 
  8.  
  9. Private Sub exportt_Click() 
  10.  
  11. n = 1 
  12.  
  13. i = DCount("*", "s_table") 
  14. MsgBox i 
  15.  
  16. If i > 65535 Then 
  17.  
  18. ren = "s_table" & n 
  19.  
  20. DoCmd.Rename ren, acTable, "s_table_tayi" 
  21.  
  22. Else 
  23.  
  24. ren = "s_table" 
  25.  
  26. End If 
  27.  
  28. While i > 0 
  29.  
  30. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, ren, "D:\export65k.xls", -1 
  31.  
  32. i = i - 65535 
  33.  
  34. old = ren 
  35.  
  36. n = n + 1 
  37.  
  38. ren = "s_table" & n 
  39.  
  40. DoCmd.Rename ren, acTable, old 
  41.  
  42. Wend 
  43.  
  44. End Sub
  45.  
  46.  
Thanks in Advance,
Aryan
Feb 25 '08 #1
3 10127
cori25
83
Option Compare Database
Option Explicit

Function ExcelExport()

[PHP]Dim db As DAO.Database
'Set Db to equal your current database
Set db = CurrentDb

Dim r As DAO.Recordset

DoCmd.SetWarnings False
DoCmd.OpenQuery "quakInits"
DoCmd.SetWarnings True

Set r = db.OpenRecordset("tblInits")

Dim strPath As String
strPath = "\\01filpr004\opersvcs$\dimiliac\Production team\Training Classes\TrainingTemplate.xls"

'Declare and Create an Excel Application
Dim xlApp As New Excel.Application
Set xlApp = CreateObject("Excel.Application")

xlApp.Workbooks.Open FileName:="" & strPath & ""
xlApp.Visible = True

xlApp.Range("A1").CopyFromRecordset r

Dim strSavePath As String
Dim strFileNm As String
strSavePath = "Path of where the spreadsheet will be saved to"
xlApp.ActiveWorkbook.SaveAs strSavePath

xlApp.Quit
Set xlApp = Nothing

End Function [/PHP]
Feb 25 '08 #2
FishVal
2,653 Expert 2GB
Hi, Aryan.

You may also take a look at a similar thread: Exporting huge records to Excel from Access

Regards,
Fish.
Feb 25 '08 #3
NeoPa
32,556 Expert Mod 16PB
FYI:
Excel worksheets can only hold a maximum of 65,536 rows.
Any more than that will always fail to export.
Feb 26 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
5
by: jsudo | last post by:
I have a Access database with a large amount of records (close to 500,000) that I would like to export to Excel. I found out that Excel has the capability of of about 65,000 rows so I know I...
1
by: David | last post by:
(dhl) Using 2K. I have a macro that I use "TransferSpreadsheet" to export a table to Excel. The excel file field type is all general. How can I keep the field format in my table to be the same in...
2
by: Regnab | last post by:
I've got my code working so that it'll count the number of columns in the table and move across (eg Range A-P and then range Q-W). Problem is when I get to the end of the single letters and get...
2
by: amitshinde02 | last post by:
Hi Experts, I have been struggling on this problem since last one month. I have a huge Excel sheet (Not well formatted) with around 10000 records or more. with around 60 fields. I want to...
21
by: bobh | last post by:
Hi All, In Access97 I have a table that's greater than 65k records and I'm looking for a VBA way to export the records to Excel. Anyone have vba code to export from access to excel and have the...
4
by: deejayquai | last post by:
Hi First of all my level = basic! My question= I have a report containing student performance data with a sub-report showing the subjects they have taken that year. I run the report group by...
2
by: piyushdabomb | last post by:
Hi, I am trying to Export rows greater than 65K (appproximately 500K records) from MS Access to MS Excel. Whenever I do that, the records only populate up the max value for 1 sheet in Excel and...
2
by: atlbearcat | last post by:
Here's one that's been bugging me for about a week now... I have a form that allows users to filter records, simple enough. But I want to give them the option to export the filtered records to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.