Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Export to CSV file

Status
Not open for further replies.

trifest

Programmer
Sep 5, 2002
52
0
0
US
I have the following code

DoCmd.TransferText "qrySelectExport", "f:\inventory\apinvExport.txt"

I can export once ok but when i try to export immediately again it says the following error. "The microsoft Jet Database engine cannot open file ". It is already opened exclusively by another user, or you need permission to view it's data." It creates an export.ini file but I cannot get it to export unless i rename it to something else such as apinvExport1.txt. Any clues on this? Thanks for the help.
 
Sounds like the file is still open. If you delay writing the second file for a few minutes instead of doing it immediately, does it work properly then? Is the CSV file exceptionally large?
 
the file is not large at all 1kb. if i wait it still makes no different. the file is not open when i do it again. it's creating a schema.ini file too that if i delete it's fine.
 
I think it is your syntax. Check the help file.
Here is the example they give, if you are using Access XP, I believe 2000 is the same:

DoCmd.TransferText acExportDelim, "Standard Output", _
"External Report", "C:\Txtfiles\April.doc"


Docmd.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)

so yours should look like

DoCmd.TransferText acExportDelim, "MySchema","qrySelectExport", "f:\inventory\apinvExport.txt"





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top