How to open another database through VBA code?

Posted on 2009-04-24
Last Modified: 2013-11-29
I want to have a button on my form open another database upon clicking.
Question by:pgerman
    LVL 65

    Expert Comment

    number of ways

    here is one

    dim acc as Access.application

    Set acc = New Access.Application
    acc.OpenCurrentDatabase "C:\mydb.mdb"

    see if this works also
    followhyperlink "c:\mydb.mdb"

    LVL 65

    Accepted Solution

    I forgot to add, the first one using OpenCurrentDatabase is handy if you want to perform some work on that db. You must remember to close it though

    set acc=nothing

    you do not need to bother with that if you use followhyperlink


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now