If your intention is to use this in code in the VBA you can try something like this
Dim qdef As QueryDef
Dim qdefs As QueryDefs
Dim i As Integer
Dim name As String
Dim qSql As String
Set qdefs = Application.CodeDb.QueryDefs
For Each qdef In qdefs
qname = qdef.name
qSql = qdef.SQL
Next qdef
the qdef object will also give you a lot more info about the query.
for c# you will have to add the ref to the project for the access interop (Microsoft Access ## Object Library)
and use
private void QueryValues()
{
Microsoft.Office.Interop.Access.Application app = new Application();
app.OpenCurrentDatabase(@"C:\Tests\C#\MS Access\WindowsApplication1\New Microsoft Office Access 2007 Database.accdb", false,"");
QueryDefs qdefs = app.CurrentDb().QueryDefs;
foreach (QueryDef qdef in qdefs)
{
string qname = qdef.Name;
string qSql = qdef.SQL;
}
app.Quit(AcQuitOption.acQuitSaveNone);
}