Results 1 to 5 of 5
  1. #1
    Cratebug is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    11

    Automatically open Database 2 when I click a button in Database 1

    Cheers all.



    Not having much luck figuring this one out.


    Is there a macro or simple vba coding that will automatically open Database 2 when I click on a button in Database 1??

    For example, if I am working in a form in Database 1 and I have a "Save" button....once I click the "Save" button, it not only saves but it also opens Database 2.
    (There is some automated stuff that runs in Database 2 during initial load after its opened)


    Any assistance with this would be greatly appreciated!!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,110
    You should be able to use Shell or FollowHyperlink to open the second database.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,265
    Set appAccess = CreateObject("Access.Application")
    docAccess = appAccess.OpenCurrentDatabase("C:\My Documents\db1.mdb", True)
    appAccess.visible= true

  4. #4
    Cratebug is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    11
    Ranman256....thanks for your response. Not able to get it working however.....not sure how this would appear in VBA.....would it be under some type of event procedure or "Private Sub"? For example, on the "On Click" property?

    (Sorry, I'm sure this is probably child's play for most of you. Still somewhat of a beginner on my end.)

    Quote Originally Posted by ranman256 View Post
    Set appAccess = CreateObject("Access.Application")
    docAccess = appAccess.OpenCurrentDatabase("C:\My Documents\db1.mdb", True)
    appAccess.visible= true

  5. #5
    Cratebug is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2016
    Posts
    11
    UPDATE:

    Found some code that worked.....



    Dim AccessApp As Access.Application

    Set AccessApp = New Access.Application

    AccessApp.Visible = True

    AccessApp.OpenCurrentDatabase ("C:\...\Database_be.mdb")


    Placed in the "On Click" property of a button I created in a form. Does exactly what I needed.




    Thanks to everyone for their input.

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

Similar Threads

  1. Replies: 2
    Last Post: 05-12-2014, 10:30 AM
  2. Report does NOT open on BUTTON CLICK
    By taimysho0 in forum Programming
    Replies: 3
    Last Post: 01-04-2012, 02:38 PM
  3. Click button to open a new image
    By tia in forum Forms
    Replies: 2
    Last Post: 10-10-2011, 11:03 AM
  4. Replies: 3
    Last Post: 12-09-2010, 11:50 AM
  5. Have database open automatically
    By Norman Masson in forum Access
    Replies: 6
    Last Post: 01-08-2008, 07:41 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