Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an .mdb file that should contain a complex query that I would like to modify.

The .mdb somehow is used to create reports against a database.

If I open the .mdb file, I see all the ribbon options, but I cannot locate a kind of "show existing queries" menu item.

How do I find a pre-existing query in a Microsoft Access file?

share|improve this question

2 Answers 2

If you do not see any tables, queries, or reports, try opening the .mdb file while holding the shift key. The tables should all appear on the left, or at least a table toolbar. If this is not the case the make sure it is not just pulling from linked tables. You may need to make sure its not loading while hiding tables as well either in VBA or the options, but holding the shift key should bypass that.

The query itself will be in this table toolbar. If you don't know which query you want, try looking at the design view of the report by right clicking the frame of the report or clicking design view in the tools.

share|improve this answer

Try this code

'Press CTRL-G to see debug window

Dim qd As QueryDef

For Each qd In CurrentDb.QueryDefs

    Debug.Print qd.Name

    Debug.Print qd.sql

    Debug.Print 

Next

Set qd = Nothing
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.