Form Size (3 Viewers)

mloucel

Active member
Local time
Today, 16:14
Joined
Aug 5, 2020
Messages
370
Hello, Gurus.

I have a very particular form, that I need to set SPECIFICALLY at Width 28440 and Height 11835, so that it fits in ALL my monitors across the board, my problem is that everytime I save the form at 5.5 inches, it keeps the size perfectly as I saved it:
1766509938812.png

But when I made a change and save goes back over and over to this:
1766510047179.png

about 1 inch, and of course when it opens as a form since it is Continuous form the data is messed up.

I've tried setting this on the ON LOAD event:

Code:
Private Sub Form_Open(Cancel As Integer)
    ' Set the inside width to exactly 28440 twips
    Me.InsideWidth = 28440
    
    ' Set the inside height to exactly 11835 twips
    Me.InsideHeight = 11835
End Sub

But the code is simply ignored, and it goes back to the above form no matter what.
I've seen online some suggestions to do it in the detail section, but that is not what I want, [is a continuous form]

Any help or point to the right direction will be appreciated.

Maurice.
 
Using the Northwind 2 Developer Edition template, in frmOrderList.Form_Open I add:
Me.InsideHeight = 6000
And it does just that.
Maybe you can compare the properties of this form with yours, to see what the issue may be.
 
The code worked for me as posted in #1
 
Have you got any of the form formating set that will mess with anything you set - also try the load event.
1766522526056.png
 
Try this in the Form_Resize event:
Code:
Private Sub Form_Resize()
  Const w As Long = 28440, h As Long = 11835
  With Me
    ' Set the inside width to exactly 28440 twips
      If Not .InsideWidth = w Then .InsideWidth = w
    ' Set the inside height to exactly 11835 twips
      If Not .Detail.Height = h - (.Section(acHeader).Height + .Section(acFooter).Height) Then
        .Detail.Height = h - (.Section(acHeader).Height + .Section(acFooter).Height)
      End If
  End With
End Sub
 
Try this in the Form_Resize event:
Code:
Private Sub Form_Resize()
  Const w As Long = 28440, h As Long = 11835
  With Me
    ' Set the inside width to exactly 28440 twips
      If Not .InsideWidth = w Then .InsideWidth = w
    ' Set the inside height to exactly 11835 twips
      If Not .Detail.Height = h - (.Section(acHeader).Height + .Section(acFooter).Height) Then
        .Detail.Height = h - (.Section(acHeader).Height + .Section(acFooter).Height)
      End If
  End With
End Sub
Now it displays only 1 record:
1766523325525.png
 
Then add a similar expression for the subform control
After a little while of moving things around, I had to go back to the original code, I just made 1 simple STUPID change.
Instead of using On Open Event, I moved the code to On Load event, that's it nothing else, for some weird and strange reason, the sizing works as expected, no matter how is saved during design view, so literally the Original code on #1 works but in the On Load Event.
Just out of curiosity I moved the code back and forth from On Load to On Open and the error is consistent.
So I just left the code in the on Load event, IF IT'S WORKING DON'T FIX IT.

Thank you so much.

I am wondering now WHY?, what makes On Load and On Open so different.
 
Sorry, I'm not thinking very clearly!! 😬

Increasing the detail height will not work here because it is a continuous form, and you will only see one record (the others will be below)
 
Actually, it doesn't look like you have a subform control.

I'm not sure why you have only one row displayed unless you have filtered the RecordSource, ????
The record source is filtered by the user, they need so many different reports, so I left those fields enabled but locked, so they can sort and filter as needed, once that is done, there is a Print Report Button and on the report I have the following code:


Code:
Private Sub Report_Open(Cancel As Integer)
    
    Me.Filter = Forms!ReportFormForAuthorizationsF.Filter
    Me.FilterOn = Forms!ReportFormForAuthorizationsF.FilterOn

    Me.OrderBy = Forms!ReportFormForAuthorizationsF.OrderBy
    Me.OrderByOn = Forms!ReportFormForAuthorizationsF.OrderByOn
    
End Sub

it works beautifully.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom