Why does Access spontaneously close when I try to open a querey?

G

Guest

I have a pretty inticate Access DB with a lot of information. When I try to
open a particular query (design or regular), it closes the entire
application. Though I can open other queries. Even more bizar is that I can
run a macro using this querey and everything works out fine.
 
S

Smartin

gladd56 said:
I have a pretty inticate Access DB with a lot of information. When I try to
open a particular query (design or regular), it closes the entire
application. Though I can open other queries. Even more bizar is that I can
run a macro using this querey and everything works out fine.

Have you tried a compact/repair?
 
A

Allen Browne

It sounds like something in the query is corrupted, so that Access cannot
display it correctly, even the the SQL executes successfully.

To solve the problem, try this sequence (in order):

1. Make a backup copy of the database while it is not in use, in case
something goes wrong.

2. Uncheck the boxes under:
Tools | Options | General | Name AutoCorrect
In Access 2007, it's:
Office Button | Access Options | Current Database | Name AutoCorrect
Explanation of why:
http://allenbrowne.com/bug-03.html

3. Compact the database:
Tools | Database Utilities | Compact/Repair
or in Access 2007:
Office Button | Manage | Compact/Repair

4. Press Ctrl+G to open the Immediate Window.
Enter this, substituting the name of your query for Query1:
Debug.Print CurrentDb.QueryDefs("Query1").SQL
When you press Enter, Access should show you the SQL statement. Copy it to
clipboard and paste it somewhere safe (such as in Notepad, and saved as a
text file.)

5. Delete the bad query.
Compact the database again.
Create a new query.
Switch the query to SQL View (View menu.)
Paste the SQL statement in.
Switch back to Design View (View menu), and arrange things as you wish.
 

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