Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9149175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:26:29+00:00 2026-06-17T11:26:29+00:00

Access has saved a query that was designed with the query builder called ‘myQuery’.

  • 0

Access has saved a query that was designed with the query builder called ‘myQuery’. The database is connected to the system via ODBC connection. Macros are all enabled.

Excel Has makes a ADODB connection to connect to the database via

Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Set con = New ADODB.Connection
With con
 .Provider = "Microsoft.ACE.OLEDB.12.0"
 .Open "MyDatabase.accdb"
End With

Usually you would go ahead and just write your SQL, which is perfectly fine and then just do something like

Dim sqlQuery As String
sqlQuery = "SELECT * FROM myTable"
Set rs = New ADODB.Recordset
rs.Open sqlQuery, con, ...

But I want to access the query that I saved in the access database. So how do I call the saved query in the database that I just connected.

Tried already

  1. con.Execute(“EXEC myQuery”) but that one told me it could not be find myQuery.
  2. rs.Open “myQuery”, con but that one is invalid and wants SELECT/etc statements from it
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:26:30+00:00Added an answer on June 17, 2026 at 11:26 am

    I think you can treat it like a stored procedure.

    If we start right before Dim sqlQuery As String

     Dim cmd as new ADODB.Command
     cmd.CommandType = adCmdStoredProc
     cmd.CommandText = "myQuery"
     cmd.ActiveConnection = con
    
     Set rs = cmd.Execute()
    

    Then pickup your recordset work after this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing Web Service that has access to database via JDBC. I'm using DAO
I have a ms access database that has one table for each photo album
I always thought that internal class has access to all data in its external
I want to define a class method that has access to a local variable.
I have a data access library that has a few classes that all implement
I have a SQL statement (saved as LocationSearch in Access) that calculates distance between
We have a WCF service that uses Entity Framework to query a SQL database.
I have a MS Access 2007 report which is based on a query that
So I am going through our database and removing some unneeded access levels that
I have program that constantly query a mysql server. Each time I access the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.