locked
How do I do this in VBA 7.1 win 7 office 2013 Ultimate 64 bit in Access. Have TWO Access files open at same time? Can do way state below. RRS feed

  • Question

  • How do I do this in VBA 7.1  win 7 office 2013 Ultimate 64 bit  in Access.

    I found I can have two (2) separate instances of Access running with different files running

    I could NOT find way to do this in Access by opening first one file and then opening another file.  Opening a different, file closed currently Open file.

    BUT I can click on Access file, in anyway I want,  to open and work on first Access file.

    Then to open at SAME TIME a second Access file I can do that by clicking first on “Start” button, (icon with the four flags in a circle)  Then click on Access showing on list “Start” button displays.

    What I am trying to do is have an  accdb file "MyDocumenter"  run "Like" an add-in. and only leave a table filed with data based on accdb code I am currently creating.  Currently MyDocumenter keeps track of all names used, where used, why used.

    and import table when Myocumenter was done.

    I am NOT sure of the right terms to use or search for my use.    

    Seem to recall from years back, to do this I would need to make the database a .exe or .com or .dll file.  (at that time I could not create one of those types of file).

    I am going to reinstall Visual Studio (free version) on Oct 6, so I might be able to create the type of file I need.  Also seem to recall I would also need to add info to 4 fields of a system table of some name I do not remember.

    The closest I have come so far is to have TWO Access files open AT SAME TIME.  I would have to copy and paste variable name and related info between both files. And when done, import the table created in MyDocumenter to the database I was creating.

    The links I have been able to find so far that refer to "Add-in" seem to be ONLY dealing with having a "App" in the App Store to download to a phone.  Not what I am trying for.   Any BETTER search terms would be very helpful, so I can use CORRECT terms for my questions.

    Code I have used before to open Access files in Word is below.     DON'T KNOW IF THIS is the way to use to have TWO files open at same time.

    Private Function OpenAccess(strPath As String)

    ‘ strPath is complete path to file want to open.

    Dim MyAccess As Access.Application

    Set MyAccess = GetObject(strPath)

    MyAccess.Application.Visible = True

    MsgBox "Close This when done with Access file " & strPath

    MyAccess.Application.Quit

    Set MyAccess = Nothing

    End Function

    Mark J


    Mark J

    Sunday, September 25, 2016 7:34 AM

Answers

  • Hi PuzzledByWord,

    According to your description, in a single instance of Access, you can have only one database open at a time. In other words, you can't start Access, open one database, and then open another database without closing the first database. However, you can run multiple instances of Access at the same time, each with a database open in it. Each time you start Access, you open an instance of it. So to open two Access databases at the same time, start Access and open the first Access database, then start Access again and open the second database in the second instance of the program.
    Public objAccess As Access.Application
    Public Sub AccessExample()
    
        'Check that this is the path on YOUR PC for
        'Northwind.mdb, which ships with Access.
        Const conPATH = "D:\MineDB.accdb"
    
        'Create an instance of the Access application object.
        Set objAccess = CreateObject("Access.Application")
    
        'Open the sample Northwind database that ships with
        'Access and display the application window.
        objAccess.OpenCurrentDatabase conPATH
        objAccess.Visible = True
    
        'Open the form.
        objAccess.DoCmd.OpenForm "FM_Teacher"
    
        ' Maximize other Access window and quit current application.
        objAccess.DoCmd.RunCommand acCmdAppMaximize
    '    Application.Quit
    End Sub

    • Proposed as answer by David_JunFeng Friday, September 30, 2016 5:28 AM
    • Marked as answer by David_JunFeng Wednesday, October 5, 2016 1:37 PM
    Monday, September 26, 2016 2:06 AM