这个问题十分的简单 我可以帮你处理这个问题 不过可要拿分来哟 下面是实例: 引用DAO 3.51 引用ADO 2.1 拿分来 有问题给我联系:[email protected] Private Sub CmdUp_Click() Dim DB As Database ' Dim MyDB As New ADODB.Connection Dim MyMDBRec As Recordset Dim MyDBFRec As New ADODB.Recordset Dim MyDBFsql As String Dim MyMDBsql As String Dim IntI As Integer Set DB = DBEngine.Workspaces(0).OpenDatabase("123") '123为MDB库 MyMDBsql = "select * from mdb表" '123中的表 Set MyMDBRec = DB.OpenRecordset(MyMDBsql) MyDB.Open "Provider=MSDASQL.1;Persist Security Info=false;Extended Properties=Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=" & (App.Path & "\dbf") & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;" '\dbf是放aa的文件夹 MyDBFsql = "select * from aa" 'aa为DBF表 With MyDBFRec .LockType = adLockOptimistic .Open MyDBFsql, MyDB, , , adCmdText MyMDBRec.MoveLast MyMDBRec.MoveFirst For IntI = 0 To MyMDBRec.RecordCount - 1 .AddNew .Fields!字段1 = MyMDBRec.Fields("字段1") .Fields!字段2 = MyMDBRec.Fields("字段2") .Fields!字段3 = MyMDBRec.Fields("字段3") .Fields!字段n = MyMDBRec.Fields("字段n") .Update MyMDBRec.MoveNext Next IntI MsgBox "数据转换成功!" End With End Sub
下面是实例:
引用DAO 3.51
引用ADO 2.1
拿分来 有问题给我联系:[email protected]
Private Sub CmdUp_Click()
Dim DB As Database '
Dim MyDB As New ADODB.Connection
Dim MyMDBRec As Recordset
Dim MyDBFRec As New ADODB.Recordset
Dim MyDBFsql As String
Dim MyMDBsql As String
Dim IntI As Integer
Set DB = DBEngine.Workspaces(0).OpenDatabase("123") '123为MDB库
MyMDBsql = "select * from mdb表" '123中的表
Set MyMDBRec = DB.OpenRecordset(MyMDBsql)
MyDB.Open "Provider=MSDASQL.1;Persist Security Info=false;Extended
Properties=Driver={Microsoft Visual FoxPro Driver};UID=;SourceDB=" & (App.Path & "\dbf") & ";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;Deleted=Yes;" '\dbf是放aa的文件夹
MyDBFsql = "select * from aa" 'aa为DBF表
With MyDBFRec
.LockType = adLockOptimistic
.Open MyDBFsql, MyDB, , , adCmdText
MyMDBRec.MoveLast
MyMDBRec.MoveFirst
For IntI = 0 To MyMDBRec.RecordCount - 1
.AddNew
.Fields!字段1 = MyMDBRec.Fields("字段1")
.Fields!字段2 = MyMDBRec.Fields("字段2")
.Fields!字段3 = MyMDBRec.Fields("字段3")
.Fields!字段n = MyMDBRec.Fields("字段n")
.Update
MyMDBRec.MoveNext
Next IntI
MsgBox "数据转换成功!"
End With
End Sub
这只是一行你只他放在一行里就行了!
你可以先把ACCESS导到EXCEL中,
然后再从VF中导入EXCEL的数据。