On 12 Jul 2001 05:59:48 -0700, "Colin Moore" <moorecj@larsens.ns.ca> wrote:
¤
¤ Hi All,
¤
¤ I need to convert DBF files to an Access mdb file or a Excel xls file. I
¤ have done lots of database programming but I have never worked with FoxPro
¤ or DBase (DBF). I'll explain why I need to convert, mabye you have another
¤ solution.
¤
¤ there is a very old system running here that collects data using a program
¤ that puts this data into DBF format, there is now a new system that has to
¤ work with the old system, the new system is programmed in RPG/400. The reason
¤ for that is for the security of the AS/400. The overall goal is to take
¤ datafrom the old system and combine it with data from the new system to create
¤ nice reports for the HR department. The problem is that RPG can only read
¤ flat files. I would export the dbf files mannually except we need this to
¤ happen at least once a day to generate the reports, so we are going to automate
¤ the program to run once a day.
¤
¤ I hope I didn't confuse you, any help would be appreciated.
¤
¤ Colin Moore
¤ IS Dept.
¤ Ext. 188
Here is some relatively straightforward code for importing a dBase file into an Access table:
Sub ImportdBaseToAccess()
Dim cnn As New ADODB.Connection
Dim sqlString As String
' Open the Connection
cnn.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\My Documents\db1.mdb;" & _
"Jet OLEDB:Engine Type=4"
sqlString = "SELECT * INTO [Table3] FROM [dBase IV;DATABASE=C:\My Documents\dBase].[dBase1]"
cnn.Execute sqlString
cnn.Close
Set cnn = Nothing
End Sub
Paul ~~~
pclement@ameritech.net
Microsoft MVP (Visual Basic)