Search code examples
vbams-accesspopupsizedatasheet

How to set the size of a pop-up subform datasheet to the desired window size below


Please bear with me as I am new to Access VBA.

I have here a subform with data sheet on it that I would like to display in Pop-Up View.

form1

If Pop Up is No, it displays the whole page.

img2

If Pop Up is Yes, it only displays this below:

halfimage

These are my properties:

properties

I tried to set Auto Resize to No, same thing happens.

What should I set here in the properties so at least it will automatically display this below:

Pop Up popup


Solution

  • Set the form's property AutoCentering to Yes.

    Use this code in the OnLoad event to set the width and the height of the form, for example:

    Private Sub Form_Load()
    
        DoCmd.MoveSize , , 12000, 8000
    
    End Sub
    

    Of course, you can also set the Top and Left position, but those are relative to the screen.