how do i connect to a DBF database from access visual basic code?

G

Guest

I'm trying to connect to a dbf file from a visual basic function (in a module
in access) to get some data and copy it in an access table...

I can't use ODBC, i must get the dbf file from a common dialog, connect to
it, get the data and close it.

Thanks...
 
G

Guest

I am assumming that you mean either a Dbase or Foxpro table. If this is
correct:
Use the TransferDatabase method. The database type is "Dbase III"
(probably). Use acLink as the transer type. Now the dbf will look like an
Access table to DAO.
You can then create an Action query that will move the data however you
want, then use the docmd.DeleteObject to remove the link.
 
G

Guest

Thank you very much.... It's working perfectly now.

Here's the code if anybody has the same problem anytime:

DoCmd.TransferDatabase acImport, "dbase III", "C:\", , "mayor.dbf",
"tempImportacion"

(imports the DbaseIII file c:\mayor.dbf in the Access table tempImportacion)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top