execel数据怎么加入accecc数据库?
我用以下的语句,不知有没有速度快点的,谢谢!
accecc数据库中已有表格,数据只是添加,不是另建表格。
dim m_dbSites As Database
Set rsBase = m_dbSites.OpenRecordset("学生成绩表")
Dim objExcel As Excel.Application
Dim objWorkBook As Excel.Workbook
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.SheetsInNewWorkbook = 1
Set objWorkBook = objExcel.Workbooks.Add
Set objWorkBook = objExcel.Workbooks.Open(App.Path & "\学生成绩.xls")
Dim objSheet As Excel.Worksheet
Set objSheet = objExcel.Worksheets("Sheet1")
For i = 1 To 1000
for j=1 to 10
rsBase.AddNew
Select Case j
Case 1
rsBase.Fields("姓名").Value =IobjSheet.Cells(i, j)
Case 2
rsBase.Fields("语文").Value =IobjSheet.Cells(i, j)
Case 3
rsBase.Fields("数学").Value =IobjSheet.Cells(i, j)
Case 4
rsBase.Fields("英语").Value =IobjSheet.Cells(i, j)
Case 5
rsBase.Fields("科学").Value =IobjSheet.Cells(i, j)
Case 6
rsBase.Fields("社会").Value =IobjSheet.Cells(i, j)
Case 7
rsBase.Fields("音乐").Value =IobjSheet.Cells(i, j)
Case 8
rsBase.Fields("体育").Value =IobjSheet.Cells(i, j)
Case 9
rsBase.Fields("品德").Value =IobjSheet.Cells(i, j)
Case Else
rsBase.Fields("总评").Value =IobjSheet.Cells(i, j)
End Select
next
rsBase.Update
Next
[此贴子已经被作者于2007-9-24 14:39:09编辑过]