shanmugamgsn
shanmugamgsn

Reputation: 840

Microsoft office Access database engine could not find the object

I created a test MS Access DB to export a table to Excel and a text file.

This works for Excel:

DoCmd.OutputTo acOutputQuery, "QryExportToExcel", _
acFormatXLS, XFile, False

For the text file, I created a specification and used this code

DoCmd.TransferText acExportDelim, "Mytable Import Specification", "mytable", "D:\myfolder\test1.txt", False

In the error message, I get "test1#txt".

The Microsoft Office Access database engine could not find the object
"test1#txt". Make sure the object exists and that you spell its name
and the path name correctly.

Error which i got

I tried creating test1.txt in the same path. To my surprise, this deleted the file which is already present.

Software: MS ACCESS 2007

Upvotes: 5

Views: 16694

Answers (5)

vfricher
vfricher

Reputation: 1

I had the same problem while my ascii file contained a dot in its name (e.g.: something.something.log). I renamed the dot for an underscore (e.g. something_something.log) and it imported fine.

Upvotes: 0

HansUp
HansUp

Reputation: 97131

The question author reported the problem was "because I was using an Import Specification for Exporting a file."

They resolved the problem by using an Export Specification.

Upvotes: 1

BMcDowell
BMcDowell

Reputation: 1

I was having a similar situation and found that a file schema.ini was in the destination folder. This was created when an acExportMerge was performed previously and it caused this error. Make sure that file has been deleted prior to executing a new TransferText.

Upvotes: 0

Heinzi
Heinzi

Reputation: 172478

The Microsoft Office Access databasse engine could not find the object "test1#txt". Make sure the object exists and that you spell its name and path name correctly.

This is a generic (and rather useless) error message that Access outputs in case anything goes wrong. One example would be a misspelled field name in the import/export specification.

You can get the "real" error message by trying the import operation "manually" in the Access user interface (rather than through code).

Upvotes: 1

EastOfJupiter
EastOfJupiter

Reputation: 781

Because you are doing DoCmd.TransferText, Access is expecting that the file Test1.txt exists in that location. Try creating the file first, and then do a transfer of the text.

You can try this code before the export to create the file:

Public Sub CreateExportFile()
 Dim strFileName As String
 Dim SomeStringToOutput

 strFileName = "d:\myfolder\test1.txt"
 Open strFileName For Output As #1

End Sub

Upvotes: 0

Related Questions