Results 1 to 3 of 3
  1. #1
    thestappa is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2008
    Posts
    16

    Open Query from another database

    Hello,



    I am using 2007. I am currently using the following to access data from a separate database for a variety of functions.


    Code:
        Dim DB As DAO.Database
        Set DB = OpenDatabase(GET_DBLINK("dbnamehere"))
    Then I can use something like
    Code:
    Set rs = DB.OpenRecordset("select * from whatever")
    to user to display data in on a form.



    However, I am running into trouble when trying to open a query for viewing. I have a simple select statement to run against a table from by DB database. I want to mimic DoCmd.openquery "QUERY" but I don't know how to tell access to use the DB database when doing so.

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    an advanced topic, yet you list yourself as novice - - and so I will ask the basic question as to why is one even taking this approach. The vanilla method is to make links to the tables of that other DB - enabling you to easily make querieis without all this complexity.

  3. #3
    thestappa is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2008
    Posts
    16
    Quote Originally Posted by NTC View Post
    an advanced topic, yet you list yourself as novice - - and so I will ask the basic question as to why is one even taking this approach. The vanilla method is to make links to the tables of that other DB - enabling you to easily make querieis without all this complexity.
    Maybe I'm just too modest...

    Or maybe I should update my profile. I started building some forms/reports pulling data from a separate db. I was getting fancy with the vba and was going to try to just do the whole thing that way.

    I did start importing objects and linking to tables so I'll probably just stick to that.

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

Similar Threads

  1. open a secure database
    By ngeng4 in forum Security
    Replies: 5
    Last Post: 08-01-2010, 10:57 PM
  2. cannot open any database
    By Factor in forum Access
    Replies: 3
    Last Post: 03-24-2010, 12:51 PM
  3. What Database is Open? (Access 2007)
    By jhrBanker in forum Access
    Replies: 3
    Last Post: 06-06-2009, 09:00 AM
  4. Have database open automatically
    By Norman Masson in forum Access
    Replies: 6
    Last Post: 01-08-2008, 07:41 AM
  5. Open form in another database
    By Karyn-2000 in forum Forms
    Replies: 0
    Last Post: 04-19-2006, 10:17 AM

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