Access交流中心

北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |

怎么将超过65000条的记录从ACCESS自动导出到多个EXCEL2003sheet中?(只导出EXCEL2003格式)

shuyangchao  发表于:2014-07-20 23:11:28  
复制

请问怎么将超过65000条的记录从ACCESS自动导出到多个EXCEL2003sheet中?本论坛的代码是乎不太对,要么就是EXCLE的代码。(只导出EXCEL2003格式,如果2007以上版本有100多万行就不用了,因为要导入的ORACLE数据库前段程序设计成只能导入EXCEL2003,只能将就这种十分弱智的设计!)

 

Top
cspa 发表于:2014-07-21 12:09:48
在导出代码中做一个计数器(循环),判断下数据导出超过5000条就新建一个sheet,并将随后数据导入到新sheet中。

李制樯 发表于:2014-07-21 19:26:30

EXCEL中使用powerpivot   处理ORACLE等等的数据,通常几百万行,并且对其进行数据分析的速度就像处理分析几百行数据一样快.要不把整个数据库的数据弄进出,然后切片机处理。

-------------------------------------------------------------------------------------------------------------------

或者可采用限制结果记录集   

或者SELECT TOP 50  PERCENT 

或者.RecordCount .AbsolutePosition.AbsolutePage.PageCount.PageSize

-------------------------------------------------------------------------------------------------------------------

还是附上一个函数

把两个数据集发送给同一个工作簿中的两个不同的电子表格
Function SendMoreThanOneRecordset()


'setp1:Declare the Objects and variables You work with
Dim xl As Excel.Application
Dim xlwkbk As Excel.workbook
Dim xlsheet As Excel.worksheet
Dim C As Integer
Dim I As Integer


'Step2:Start a new recordset ,create  a new instance of Excel ,start a workbook
Set MyRecordset = New ADODB.Recordset
Set xl = New Excel.Application
Set xlwkbk =xl.workbooks.Add


'step3:Make the instance of Excel visible
Xl.visible = True


'Step4:Assign a dataset to the recordset object
MyRecordset.open "PvTblFeed",CurrentProject.Connection, adopenstatic


'Step5:Add a new worksheet and name it
Set xlsheet =  xlwkbk.worksheet.Add
Xlsheet.name = "Pivot Table Feed"


'Step6: Copy the records to the active Excel sheet starting
'with cell A2 in order to leave room for the column headings
With xlsheet 
Xl.Range("A2").CopyFromRecordset MyRecordset
End with


'Step 7:Enumerate through the field in the recordset and 
'add column heading names to the spreadsheet 
C = 1
For I = 0 To MyRecordset.fields.count - 1
Xl.ActiveSheet.Cell(1,C).Value = MyRecordset.Fidlds(i).name
C = C + 1
Next I


'Step 8 :Close the current recordset and repeat steps 4-7 for a new recordset
MyRecordset.close 
MyRecordset.open "MainSummary",CurrentProject.connection ,adopenstatic


Set xlsheet = xlwkbk.worksheets.Add
Xlsheet.Name = "Main Summary"


With xlsheet
Xl.Range("A2").CopyFromRecordset MyRecordset
End with


C = 1
For I = 0 To MyRecordset.Fidlds.Count - 1
Xl.Activesheet.cell(1,c).Value = MyRecordset.Fidlds(i).name
C = C + 1
Next I


'step 9 :Memory Clean up
Set MyRecordset = Nothing
Set xl = Nothing
Set xlwkbk = Nothing
Set xlsheet = Nothing


End Function





总记录:2篇  页次:1/1 9 1 :