form size not as described (1 Viewer)

murray83

Games Collector
Local time
Today, 15:39
Joined
Mar 31, 2017
Messages
728
Afternoon

having some fun with a simple popup form which wont stay at the size I want it to

when I'm in design mode and go to form view it looks right and I'm a happy little camper but then when I compact and repair or close and exit it fills the whole dam screen, which is not what I wanted

please help :banghead:

pictures attached
 

Attachments

  • form view.png
    form view.png
    87.1 KB · Views: 41
  • main view.jpg
    main view.jpg
    96.4 KB · Views: 36

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:39
Joined
May 21, 2018
Messages
8,463
Try editing a control such as moving it. Then save. Then open.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 23:39
Joined
May 7, 2009
Messages
19,169
if still you are unable to accomplish this, you can save the form size to a table.
create a table (FormSize) with the following fields:
Code:
FormName        short text
Left            long
Top             long
Height          long
Width           Long
add appropriate event on the form's Open and Close Event:
Code:
Private Sub Form_Close()
CurrentDb.Execute "update [FormSize] set " & _
                        "[Top] = " & Me.WindowTop & "," & _
                        "[Left] = " & Me.WindowLeft & "," & _
                        "[Height] = " & Me.WindowHeight & "," & _
                        "[Width] = " & Me.WindowWidth & " " & _
                    "Where " & _
                    "FormName = '" & Me.Name & "';"
End Sub

Private Sub Form_Open(Cancel As Integer)
Dim db As DAO.Database
Dim rs As DAO.recordSet
Set db = CurrentDb
Set rs = db.OpenRecordset("select * from FormSize Where FormName = '" & Me.Name & "';")
With rs
    If Not (.BOF And .EOF) Then
        .MoveFirst
        Me.Form.Move !Left, !Top, !Width, !Height
    Else
        
        .AddNew
        !FormName = Me.Name
        !Top = Me.WindowTop
        !Left = Me.WindowLeft
        !Width = Me.WindowWidth
        !Height = Me.WindowHeight
        .Update
    End If
    .Close
End With
Set rs = Nothing
Set db = Nothing
EDITED
 
Last edited:

Users who are viewing this thread

Top Bottom