Does anyone have any suggestions on importing a DBF table into an Access table using VBA?
I tried the following code but get a message that the object being imported cannot be found.
Executing the code causes the error "object cannot be found" and displays the following path.
"C:\Documents and Settings\delliott\Desktop\Piece Rate Tickets Salem\DB w RS\Excel test\TOTALS.DBF"
I'm assuming it does not recognize TOTALS.DBF as a legitimate file the way the code is written. The path is correct.
If I am unable to import the DBF file using VBA, would I be able to use VBA to convert the DBF table to an Access table? I can open the DBF in an Access table and save it, but it would be helpful to have a routine written in VBA to convert it or import it. Is there a way to open with Access and then save it using code? The DBF file defaults to Foxpro on my machine.
Thanks for any help.
I tried the following code but get a message that the object being imported cannot be found.
Code:
Private Sub cmdExport_Click()
DoCmd.TransferDatabase transfertype:=acExport, _
databasetype:="Microsoft Access", _
databasename:="C:\Documents and Settings\delliott\Desktop\Piece Rate Tickets Salem\DB w RS\Excel test\Piece DB Test.mdb", _
ObjectType:=acTable, Source:="C:\Documents and Settings\delliott\Desktop\Piece Rate Tickets Salem\DB w RS\Excel test\TOTALS.DBF", _
Destination:="whattbl", structureonly:=True
End Sub
Executing the code causes the error "object cannot be found" and displays the following path.
"C:\Documents and Settings\delliott\Desktop\Piece Rate Tickets Salem\DB w RS\Excel test\TOTALS.DBF"
I'm assuming it does not recognize TOTALS.DBF as a legitimate file the way the code is written. The path is correct.
If I am unable to import the DBF file using VBA, would I be able to use VBA to convert the DBF table to an Access table? I can open the DBF in an Access table and save it, but it would be helpful to have a routine written in VBA to convert it or import it. Is there a way to open with Access and then save it using code? The DBF file defaults to Foxpro on my machine.
Thanks for any help.