name error

name error

Post by cmR2 » Fri, 18 Jul 2008 22:50:00


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.
 
 
 

name error

Post by Allen Brow » Fri, 18 Jul 2008 23:03:04

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://www.yqcomputer.com/

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://www.yqcomputer.com/

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://www.yqcomputer.com/
Reply to group, rather than allenbrowne at mvps dot org.