Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

VB.net List all query name in an Access database


What VB.net code would I use to add all the query names in an Access database to a
ComboBox. I use a connection string to connect to the Access Database

Murray Brown
Murray Brown
1 Solution
käµfm³d 👽Commented:
If you add a reference to the "Microsoft Access 14.0 Object Library", or whichever version you have installed, then you should be able to open the database and loop over the queries using something like:

Module Module1

    Sub Main()
        Dim y As New Microsoft.Office.Interop.Access.Dao.DBEngine()
        Dim x As Microsoft.Office.Interop.Access.Dao.Database = y.OpenDatabase("C:\path\to\database.accdb")

        For Each query As Microsoft.Office.Interop.Access.Dao.QueryDef In x.QueryDefs

    End Sub

End Module

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now