Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Harrow, UK

    Angry Unanswered: Switch to another database

    I'd like to have a button on a form which OnClick would open up another database.

    Is this possible? I've tried Using the wizard and selecting "Run App" but it won't let me point to an .MDB
    Thank you,

  2. #2
    Join Date
    Jan 2003
    Rockville, MD
    Try this jamesmc2:
       Dim objAccessApp As Object
       Dim strMDBName As String
       strMDBName = "C:\MyFolder\MyDatabase.mdb"
       'might want to check to be sure file exists first!!
       Set objAccessApp = CreateObject("Access.Application")
       objAccessApp.Application.OpenCurrentDatabase strMDBName
       On Error Resume Next
       objAccessApp.Application.Visible = True
       On Error GoTo 0
    I've got these references set, though I'm not sure which ones you actually need for the code sample to work.

    Visual Basic For Applications
    Microsoft Access Object Library
    Microsoft DAO Object Library
    OLE Automation
    Microsoft Visual Basic for Applications Extensibility

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts