Problem opening other databases from a "Main Form"

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I have a database that consists of a form with buttons that are used to
access the various access databases we use in our group. The "Main Form"
database opens Access full screen with the form opening up in the screen
middle. When I click on one of the buttons, Access is opened in a smaller
window to the left that I continually have to "Maximize". I then also need
to move the switchboard form of each program to the middle as well.

Here is a sample of the code I have assigned to one of the buttons.

Private Sub cmdMyButton1_Click()
' Initialize string to database path.
Const strPath = "H:\MyPath\"

strDB = strPath & "MyFile.mde"

' Create new instance of Microsoft Access.
Set appAccess = _
CreateObject("Access.Application")

' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB

'Closes Main Form database'
Application.Quit
End Sub

Is there any way to set it up to always open each application maximized with
the switchboard form in the screen middle? I tried setting an AutoExec
macro to each database that maximized it, but it didn't work. Thanks in
advance!

Bill
 
You could try using a macro with action RunCommand with
"Command" argument "AppMaximize"

Jim
 
I tried looking in VBA HELP to see what and where to put that line of code.
I tried "DoCmd.Maximize" before and it didn't work. Would I need to put
that code in the macro below just above the "Application.Quit" or does each
database need to have an AutoExec macro with that command assigned to it?
Sorry for my VBA ignorance when it comes to Access, but I am still a newbie.

Thanks for your continued support!

Bill
 
Create a macro and name it autoexec. In this macro use
runcommand with the argument AppMaximize. You can also add
any forms you need at this time to open.

Jim
-----Original Message-----
I tried looking in VBA HELP to see what and where to put that line of code.
I tried "DoCmd.Maximize" before and it didn't work. Would I need to put
that code in the macro below just above the
"Application.Quit" or does each
 
Thanks, I'll try it out.

Bill
Jim/Chris said:
Create a macro and name it autoexec. In this macro use
runcommand with the argument AppMaximize. You can also add
any forms you need at this time to open.

Jim

"Application.Quit" or does each
 
Not sure what I was thinking, but since I normally deal with VB modules
instead of macros (even though I can them that), I was confused. After
going into the macros, I got each database to open up maximized.

However, now I have another problem. I have created the MDBs and split them
into front ends and back ends. I then took the MDB front ends and made MDEs
out of them and used the MDE files link to the code for the buttons of the
"main" database.

If I double-click on either the MDB or the MDE, the switchboard opens in the
middle of the window. When I click on the button on my "main" database, the
window opens maximized now, but the switchboard is at the top left!

Any additional fixes or ideas? My code (below in the thread) is still what
I use for a sample.

Thanks again!

Bill
 
Back
Top