Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2014
    Posts
    3

    Unanswered: Resizing Forms in Access

    I have the following code connected to a button to open two forms side by side. If I open the database by holding shift to get to the back end this works fine and does what it is expected to do. If I open the database where the back end is hidden it just opens both forms, one behind the other. Any thoughts on how I can get both windows to open when I open the database normally? I have "enable layout view", "enable design changes...", "display status bar" un checked. I am using SimpleFile ribbon to hide all of the options from the users. Any help is greatly appreciated.

    Sub TwoWindows()
    Dim bottom, right As Integer
    bottom = 12700
    right = 10000

    'Left Form
    DoCmd.OpenForm "form1", acNormal, , , , acWindowNormal
    DoCmd.MoveSize 0, 0, right, bottom
    'right Form
    DoCmd.OpenForm "form2", acNormal, , , , acWindowNormal
    DoCmd.MoveSize right, 0, right, bottom

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You could use:
    Code:
    Private Sub Form_Open(Cancel As Integer)
    
        Me.Move 0, 0            ' top left.
        Me.Move 14340, 8850     ' bottom right for a screen resolution of 1280x1024.
        
    End Sub
    Have a nice day!

  3. #3
    Join Date
    Sep 2014
    Posts
    3
    Thansk for the suggestion! I tried the me.move exactly as suggested and it didn't work. I got the Invalid use of Move method error. I then tried deleting one line since it seemed like it was calling the same thing twice to move it to different spots. I got the same error. I then tried

    Me.Move Left:=0, Top:=0, Width:=400, Height:=300

    and got the same error. The wierd thing is that the code that I entered originally works just not when I enter the database without using shift. I can't get the me.move stuff to work at all and yes I did put it in the form on open event. I then tried the below code in the on open event and it works if I open the database with shift, but not if I enter normally.

    bottom = 12700
    right = 10000
    DoCmd.MoveSize 0, 0, right, bottom

  4. #4
    Join Date
    Sep 2014
    Posts
    3
    Thanks for the suggestion Sinndho! I tried the code as you posted it and it gave me an error saying improper use of Move. I then tried it with only one line of code and it gave the same error. I then tried it with the line

    me.Move Left:=0, Top:=0, Width:=400, Height:=30

    and it still didn't work. I was putting all of these iterations in the form on open action. I tried putting my original code without the open portion in the on open action and it worked like before, but only if I open the database while holding shift. Is there some setting that makes it always go fullscreen when opening a database without the back end visible? I have autosize and autocenter set to no.

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Is the database configured to work with tabbed or MDI documents?
    Have a nice day!

Posting Permissions

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