tags:

views:

38

answers:

1

I'm working on some VBA to do exporting and importing (using SaveAsText and LoadFromText) of MS-Access objects in an application I'm supporting. I'm hoping to be able to start storing my code in SVN so that more than one developer can work on this application at once.

I keep getting the following error when I bring in queries that start with ~sq_

2285 - Microsoft Access can't create the output file.

Anecdotally, when I skip the ~sq_ files, my forms and reports seem to work. Is this safe to do long term?

+1  A: 

When you use a SELECT statement as the RecordSource for a form, Access creates a hidden query. When you SaveAsText for the form, the file includes that same SELECT statement as its RecordSource property. So when you LoadFromText, Access can recreate the hidden query. I suspect the same thing happens for report RecordSources, but I haven't actually checked. I skip those ~sq queries for SaveAsText.

HansUp
Actually, these are not hidden queries, but hidden objects that are used to store the compiled query plan for SQL statements that are not saved QueryDefs. They should be ignored for all purposes -- they are not of any use to the end user.
David-W-Fenton
@David I don't understand. Those objects are included in CurrentDb.QueryDefs. They are not displayed in the Database Window. And CurrentDb.QueryDefs("~sq_ffrmMyTable").SQL returns the SELECT statement. How are they not hidden queries?
HansUp
I knew they were in the QueryDefs collection, but I didn't know you could get the SQL from them, so I guess they are hidden QueryDefs. They should be entirely ignored, in any event, as you have no control over their creation, updating, naming and deletion.
David-W-Fenton