score:0

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

score:0

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.

score:1

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).

score:1

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.


Related Query

More Query from same tag