Results 1 to 4 of 4
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening Mdb Using GetObject Function (2003)

    I'm using the following code to open an mdb from within another one.
    <font color=448800> <pre>Private Sub Comando29_Click()
    On Error GoTo Err_Comando29_Click
    Dim stAppName As String
    stAppName = "C:PadanaPadana.mdb"
    Dim objAccess As Object
    Set objAccess = GetObject _
    (stAppName)
    Exit_Comando29_Click:
    Exit Sub
    Err_Comando29_Click:
    MsgBox Err.Description
    Resume Exit_Comando29_Click
    End Sub</pre>

    </font color=448800>
    The mdb doesn't open maximised though.
    Is there a way to achieve that?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Opening Mdb Using GetObject Function (2003)

    Try

    objAccess.Parent.RunCommand acCmdAppMaximize

    If you would run this code from another application than Access, replace the symbolic constant acCmdAppMaximize with its value 10.

    Note: when I run the GetObject line, the database is opened in an invisible instance of Access, so I must use

    objAccess.Parent.Visible = True

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening Mdb Using GetObject Function (2003)

    Thank you Hans,
    what are the drawbacks of not using
    objAccess.Parent.Visible = True ?
    Since in this particular case the window opens maximised even if objAccess.Parent.Visible = True is commented.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Opening Mdb Using GetObject Function (2003)

    If the database is visible without the line

    objAccess.Parent.Visible = True

    you obviously don't need this line. I mentioned this because when I run the code without that line, the database is opened in a hidden instance of Access.

Posting Permissions

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