Database Engine Cannot Find the Object

Simple export code with perplexing error.

My MS Access database refuses to export all of a series of queries as pipe-delimited text files. At first it was giving me an error message saying "...database engine could not find the object..." and then naming the object but replacing the period/dot (.) before the file extension with a pound/number sign (#). After I imported all db objects into a clean database with and recreated the import specs the # disappeared, but the error message remains.

The queries are all virtually the same, just filtered differently. I tried creating multiple Export Specs, but that only had limited success. I've tried shortening the names of the queries and exported files - nothing. I've tried creating a table with the same name from each query and exporting that, deleting it and re-creating it with the new set of data - zilch. I've artificially created the files. The database deletes it and then exports a new version - or doesn't. I have full access to the server and folder, and the same error occurs (sometimes) even when I test on a local folder on my laptop. I even tried removing all the underscores from the query/file names, but it didn't make a damn bit of difference.

I'm at a complete loss. There are no periods/dots in the file name, only in the *.txt part.

Basically, the export line is, in essence, this:

     DoCmd.TransferText acExportDelim, "ExportPipeDelimited", "File_Name", "C:\Folder\File_Name.txt", False

ANY help would be greatly appreciated.
Frank SellersAnalyst/DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't see anything wrong if in "File_Name" is real name of your query.
Can you prepare small sample with exact code and some dummy tables/queries?
Frank SellersAnalyst/DeveloperAuthor Commented:
In the following code, the 'strFile' variable contains the name of the query to be exported as a pipe-delimited text file (per the 'ExpPipeDel' export spec), and the variable 'strPathFile' contains the full path and text file name with the '*.txt' ending. Even when everything is written out and I don't use variables, I still get the same error.

'   Export File
'   =========================================================================
    DoCmd.TransferText acExportDelim, "ExpPipeDel", strFile, strPathFile, False
I've asked sample DB. Code is correct, so error is anywhere else.
Frank SellersAnalyst/DeveloperAuthor Commented:
Craziest thing - I was assigned the variables with a a 'For i = 1 to 12' loop because there weren't that many queries to export. I decided to list the queries in a table and throw them into a recordset and voilà! Everything exported perfectly! I have no idea why a recordset works and the other way doesn't; the variables are the same, after all.

Thanks for trying to help.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Frank SellersAnalyst/DeveloperAuthor Commented:
Discovered solution through my own experimenting without any helpful suggestions from anyone.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.