" is not a valid name

Posted on 2009-04-22
Last Modified: 2012-11-08
I receive the following error message when attempting to open about 50 % of my queries in design after upgrading to Access 2007 from Access 2003.

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

I've tried the compact/repair without success.  I also created a blank database, then imported the objects from the originall db without success.  Would appreciate any assistance you can give me.  I tried the above suggessions after reading previous posts but had no luck.
Question by:wmb02
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    "I also created a blank database, then imported the objects from the originall db without success."

    Try this .... import ALL of the Tables *first* ... and then queries, etc.

    LVL 5

    Expert Comment

    How many Queries do you have?  Would it be feasible to re-create them by:
    In the old database, open each query in design view, click View, choose SQL View, hightlight and copy the code out
    in the new database, start a new query in design view, click View, choose SQL view, paste in your SQL code
    Is there any way you can post both your old and new databases?

    Author Comment

    I will try both suggestions and will let you know the outcome.

    Author Comment


    Hello, thanks for your help.  I did try to import just the tables first&.  And I am not able to open the problem tables in SQL view or design view&  thanks.
    LVL 5

    Expert Comment

    You won't be able to open tables in SQL view.  Only the queries.  Your post seemed to me that you were having problems with just your queries.  Any chance you can post your databases?  or at least their structure (take all of the data out)?
    LVL 75

    Expert Comment

    by:DatabaseMX (Joe Anderson - Access MVP)
    " is not a valid name"

    Have you opened one of there queries in design view to see what's up?  Do you see a lot of Expr1, Expr2, etc ?


    Author Comment

    I can't even open the query.  Whenever I try opening the query I receive the error message:
    " is not a valid name. Make sure that is does not include invalid characters or punctuation and that it is not too long.
    LVL 75

    Accepted Solution

    OK .... go back to your A2003 master and run the procedure below first.  Fix any errors you may encounter.     Then, create a new ACCDB and Import all objects into the new ACCDB from the 'clean' MDB.

    A **DeCompile** may help here ...

    But first, if you have not already:
    Open the VBA Editor and from the menu ...Tools>>References ....
    If you see any listed as **Missing: <reference name>, including the asterisks and the word Missing, the
    you need to fix that first.

    Then, follow this procedure:

    0) **Backup your MDB BEFORE running this procedure**
    1) Compact and Repair the MDB, as follows:
    Hold down the Shift key and open the MDB, then from the menu >>Tools>>Database Utilities>>Compact and Repair ...
    Close the mdb after the Compact & Repair.
    2) Execute the Decompile (See example syntax below) >> after which, your database will reopen.
    3) Close the mdb
    4) Open the mdb and do a Compact and Repair (#1 above).
    5) Close the mdb.
    6) Open the mdb:
        a) Right click over a 'blank' area of the database window (container) and select Visual Basic Editor. A new window will open with the title 'Microsoft Visual Basic' ... followed by then name of your MDB.
        b) From the VBA Editor Menu at the top of the window:
            Note ... after the word Compile will see the name of your 'Project' - just an fyi.

    7) Close the mdb
    8) Compact and Repair one more time.

    *** Executing the DeCompile **EXAMPLE**:
    Here is an **example** of the command line syntax  (be SURE to adjust your path and file name accordingly) before executing the decompile:

    Run this from Start>>Run, enter the following command line - **all on one line** - it may appear like two lines here in the post:
    Also, the double quotes are required.

    "C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\YourMdbNameHERE.mdb"

    For more detail on the Decompile subject ... visit the Master on the subject (and other great stuff) Michael Kaplan:



    Author Closing Comment

    Used some of the suggestions, however suggestions didn't completely resolved my issue.  PLEASE CLOSE QUESTION.

    Expert Comment

    Access does not permit illegal characters in the file path or name.  The list below applies to web Access, but I believe that it also impacts desktop Access:

        Brackets ([])
        Forward slash mark (/)
        Backward slash mark (\)
        Ampersand (&)
        Tilde (~)
        Question mark (?)
        Asterisk (*)
        Pipe or vertical bar (|)
        Angle brackets (<>)
        Quotation marks (")
        Number sign (#)
        Semicolon (;)
        Colon (:)
        Plus (+)
        Period (.)
        Two periods (..)

    Please see the following article (based on web Access) for more information:

    I have the same problem as you, and as my userID for my company computer is firstname.lastname I will always have this error.  That is unless there is a way to suppress the message through VBA or an application setting for suppressing error messages that arise from the application and not VBA.

    Until then I have taken heart that while the error does appear, functionality after clicking okay is not affected in my case and I am able to perform filters, etc., without hindrance.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Suggested Solutions

    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now