name error

R

rdv

I have a select query in Access 2007. It has always worked in the past, and
still works when I run it. However, when I try to switch to design view, I
get an error message which reads:

" is not a valid name. Make sure that it does not include invalid
characters or punctuation and that it is not too long.

Again, it runs fine, it just won't let me into design view.
 
A

Allen Browne

Open the Immediate Window (Ctrl+G)

Enter:
? CurrentDb.QueryDefs("Query1").SQL

Access will print out the entire query statement for you.

The create a new (blank) query, switch to SQL View, and paste the query
statement in there. Then try switching to design view.

(If it is a long query statement that runs onto multiple lines in the
Immediate Window, you may have to fix up the line endings to get the query
to work.)

Once you get it working you can delete the old query, and save the new one
in its place.

Other things that might help:
a) Make sure Name AutoCorrect is turned off:
http://allenbrowne.com/bug-03.html

b) A compact/repair may help.

c) If the SQL statement is fine but the query is not, the problem might be
with the OrderBy or Filter properties of the query. You might be able to
clear these properties programmatically, and so rescue the query. (That's
effectively what the above is doing by replacing it.)

d) Other general suggesions on rescuing a database that's not working right:
http://allenbrowne.com/recover.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top