import .dbf

deekras

Registered User.
Local time
Today, 22:22
Joined
Jun 14, 2000
Messages
169
i want to import a .dbf file.

i am able to do it from file>get external data>import. and it imports nicely

however, when i try to write code for it with transfertext, i get an error message "Cannot update. Database or object is read-only."

the file is not a read only and i can import it the other way.

what can i do to import it with code?
 
i tried this
DoCmd.TransferSpreadsheet acImport, 8, "after", "f:\path\current.dbf", False, ""

i get error message
"external table is not in the expected format"

when i tried this
DoCmd.TransferText acImportDelim, "", "after", "f:\path\current.dbf", False, ""

i get error message
"cannot update. database or object is read-only."
 
If this is a dbase file, which it seems to be you should use;

DoCmd.TransferDatabase acImport, "Dbase 5.0", "F:\Path\Current.dbf", acTable, _
Import TableName1, destination TableName


You may need to change the version number of the database type to DbaseIII or IV as appropriate. You substitute your source and destination names in the last two arguments.

HTH
 
thanks.

for future readers:
works with just one tiny correction.

it should read:

docmd.transferdatabas ac import, "Dbase 5.0", "f:\path", actable, "current.dbf", "after"
(just the path - not the file)
 

Users who are viewing this thread

Back
Top Bottom