Importing a .dbf file and programming it using VBA

D

Daniel

I can copy allright a file from floppy to HDD. Here is the
code:

Sourcefile="a:\jml.dbf"
DestFile="d:\boulot\access\srf\jml.dbf"
file copy sourcefile, destfile

But when I want to import the copied file, using the
following code:

SourceFile="d:\boulot\access\srf\jml.dbf"
DoCmd.TransferDatabase acImport,"dbase IV", Sourcefile,
acTable, "srf.mdb", "imported_jml"

I get the following error number 3044 corresponding
to "d:\boulot\access\srf\jml.dbf" is not a valid path.
How come ??? Help from my fellow programmers is much
needed.
Thanks... Daniel
 
J

Joe Fallon

I use this syntax:
DoCmd.TransferDatabase acImport, "dBase 5.0", strLocalDir, acTable,
strFileName, strTableName

Your syntax:
SourceFile="d:\boulot\access\srf\jml.dbf"
DoCmd.TransferDatabase acImport,"dbase IV", Sourcefile, acTable, "srf.mdb",
"imported_jml"

Suggested syntax:
DoCmd.TransferDatabase acImport,"dbase IV", "d:\boulot\access\srf",
acTable, "jml.dbf", "myAccessTable"
 
D

daniel

it works all right... Thanks again.. Daniel
-----Original Message-----
I use this syntax:
DoCmd.TransferDatabase acImport, "dBase 5.0", strLocalDir, acTable,
strFileName, strTableName

Your syntax:
SourceFile="d:\boulot\access\srf\jml.dbf"
DoCmd.TransferDatabase acImport,"dbase IV", Sourcefile, acTable, "srf.mdb",
"imported_jml"

Suggested syntax:
DoCmd.TransferDatabase acImport,"dbase IV", "d:\boulot\access\srf",
acTable, "jml.dbf", "myAccessTable"
--
Joe Fallon
Access MVP






.
 

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