Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Location
    Victoria, Br. Columbia, Canada
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    RunSQL and OpenQuery (Access 2002)

    Helen Feddema on page 904 of Access Inside Out says, "Curiously (and inconsistently) the RunSQL method of the DoCmd object, when run from a library database, works on tables in the calling database, whereas the OpenQuery method works on tables in the code database".

    I am re-writing a Database I created in Access 97 and I find that I can't just write queries and call them with DoCmd.OpenQuery "queryname". What's the difference between the code database and the calling database? Is there a way around this, so I can just import the queries and run them with DoCmd.OpenQuery?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: RunSQL and OpenQuery (Access 2002)

    I don't think the peculiarities of OpenQuery should give you too much trouble. As long as the code database and the calling database are the same, there isn't any distinction. Where this gets to be a problem is when the code database is a library database that you have invoked from the calling database. In that case the OpenQuery will try to run a query in the library database. Hopefully you are using a library database. If that turns out to be the case, then you would want to do a RunSQL to execute a query in your calling database. It is a bit confusing isn't it! <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •