import .dbf file

G

Guest

Hi all,
In a form I'm trying to code in VBA to import a .dbf file into my current
open access application as a tbl_Temp table. The location of .dbf file is @
c:\my dir\sample file\SampleDBF.dbf.
(I tried this but doesn't work:
DoCmd.TransferDatabase acImport, "dBase 5.0", "c:\my dir\sample
file\SampleDBF.dbf", acTable, "SampleDBF.dbf , "tbl_Temp")
Thank in advance...
 
B

bob

Access 97 has the ability to treat DBF files pretty well. For example, you
can attach to the DBF as an external data source (ODBC not needed)..I am
pretty sure you can import the data also.

Later versions of Access (2000 and later?) do not have this ability.

I am doing this from memory since I now use Access 2003 and it will NOT
handle DBF files ..3rd party tools are available for this, tho.

Bob
 
G

Guest

Hi Bob,
Thanks for reply.

I'm using 2003 too. I can import that file from menu. So what you mean is
that I can't code in VBA to import dbf file? can you tell me which 3rd party
tool is ava.?

Thanks
VP
p.s: I do some search and rewrite it..

DoCmd.TransferDatabase acImport, "dbase IV", "C:\WORK\My Access Work\Temp",
acTable, "DBFTestFile.dbf", "tbl_Temp"

but still have run-time error '3011' "The MS Jet database engine could not
find the ojbect "DBFTestFile.dbf". Make sure the object exists and that you
spell its name and the path name correctly"
 
C

Charles E. Vopicka

i do this regularly with multiple versions of Access (97 - xp) there are
a few things i think. this is from memory so...


DoCmd.TransferDatabase acImport, "dBase 5.0", "c:\\my dir\\sample
file", acTable, "SampleDBF.dbf , "tbl_Temp"


note the double \\. this stumped me for the longest time

also note the source database is actually the folder the database
resides in. also took me a while to figure out. i don't remember if
the path has to be terminated with \\ or not.

you may need to be careful with long path names especially with spaces /
funny characters and extra ".". i think i have noticed that the dbf
drivers are still in the land of 8.3

hope this helps. if not i will look up some code for you that i know works.



V.P. said:
Hi all,
In a form I'm trying to code in VBA to import a .dbf file into my current
open access application as a tbl_Temp table. The location of .dbf file is @
c:\my dir\sample file\SampleDBF.dbf.
(I tried this but doesn't work:
DoCmd.TransferDatabase acImport, "dBase 5.0", "c:\my dir\sample
file\SampleDBF.dbf", acTable, "SampleDBF.dbf , "tbl_Temp")
Thank in advance...


--
Charles E. Vopicka's (Chuck) : (e-mail address removed)

Database Management, GIS Specialist and Research Assistant

Forest Biometrics Research Institute
University of Montana - College of Forestry and Conservation
Missoula, MT 59812
United States of America

Phone:
(406)243-4526
(406)243-4264
(406)549-0647 (Home)

:) HAVE A NICE DAY (-:

"UNLESS" (The Lorax, by Dr. Seuss)
 
G

Guest

Hi Charles,

Thanks for reply and offer.

I got it work. I tested the code in a test form (db1.mdb), it doesn't work,
but when I put that code in my "real" form in different database file then it
work! I don't understand why, but it works and that's all I care.
Again.
Thanks
VP
 

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