Results 1 to 2 of 2
  1. #1
    manicamaniac is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2010
    Posts
    13

    Exclamation Running a query from another database

    Hello,



    I need to run an Append Query from another database, but I'm having problems with it..
    Set db = OpenDatabase("T:\DATA\GPM\AccessDB\GPM_custom_rpts .mdb")
    DoCmd.OpenQuery "qry_123", acNormal, acEdit

    When I run this code, an error message is shown saying that could not run the specified query... Any possible solutions?


    Thanks a lot!

  2. #2
    ExpertNovice is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    4
    From the OpenQuery Method documentation in Access 2003
    Code:
     
            QueryName Required Variant. A string expression that's
            the valid name of a query in the current database
    The issue:
    Notice the OpenQuery command never references the "db" object set in the previous statement. (The space before .mdb is not hurting anything at this point.)


    option 1:
    Create a query in the current database similar to the following:
    Code:
          SELECT * FROM qry_123 IN "T:\DATA\GPM\AccessDB\GPM_custom_rpts.mdb"
    The set db command is not need. (If used for another purpose don't forget to "set db = nothing" when done.)


    option 2:
    This is very doubtful. However, if the executing database is running as an automation server you could execute a macro in GPM_custom_rpts and have the macro execute the query. Google AccessAutomation.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query with a running sum
    By is49460 in forum Queries
    Replies: 3
    Last Post: 09-07-2013, 11:11 PM
  2. Running a Query within a Form
    By BrianFawcett in forum Queries
    Replies: 0
    Last Post: 05-12-2010, 09:19 AM
  3. Running Sum Problem in Query and Chart
    By sandyg in forum Access
    Replies: 0
    Last Post: 12-01-2009, 01:02 PM
  4. Running Count Query
    By monkey2003 in forum Queries
    Replies: 0
    Last Post: 09-21-2009, 12:24 PM
  5. Replies: 0
    Last Post: 06-21-2009, 01:29 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums