Rabu, 20 Oktober 2010

convert all data from dbf file to mdb file

Hi All
I have a dbf file and i want to convert all data from dbf file to mdb file.
Or
I want to transfer the dbf file records to the mdb fiile.
Can anybody give me sample example???
Thanking You,
Harshad Mahant
Here i send Reply
Option Explicit
Public Function movedata()
Dim MyConn
Dim MyConn2
Set MyConn = New ADODB.Connection
Set MyConn2 = New ADODB.Connection
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & ";Extended Properties=dBASE IV;\U11M710.DBF;"
MyConn2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\test.mdb;"
MyConn.Open
MyConn2.Open
Dim rs
Set rs = MyConn.Execute("SELECT * FROM U11M710")
With rs
Do While Not .EOF
MyConn2.Execute ("INSERT INTO temp(ABC,DEF) VALUES ('" & rs("A4") & "','" & rs("A5") & "')")
.MoveNext
Loop
End With
End Function
Private Sub Command1_Click()
Call movedata
End Sub
Its 100% working Enjoy...

Tidak ada komentar:

Posting Komentar