change width and hight of form

  • Thread starter Thread starter Roy Goldhammer
  • Start date Start date
R

Roy Goldhammer

Hello there

I have form which is opened in dialog mode

Is there a way to change by code form with in this case?
 
Roy Goldhammer said:
Hello there

I have form which is opened in dialog mode

Is there a way to change by code form with in this case?


You can pass the desired width and height using the OpenArgs argument of the
DoCmd.OpenForm method, and then parse them in the Open event of the target
form. Here's an example that shows two ways of sizeing the form using the
parsed values, one of them commented out ...

Code behind the source, calling form ...

Private Sub Command0_Click()

DoCmd.OpenForm "Form2", , , , , acDialog, Me.txtWidth & "," &
Me.txtHeight

End Sub

Code behind the target, called form ...

Private Sub Form_Open(Cancel As Integer)

Dim varSize As Variant

If Not IsNull(Me.OpenArgs) Then
varSize = Split(Me.OpenArgs, ",")

'alternative method commented out
'DoCmd.MoveSize 1000, 1000, varSize(0), varSize(1)

Me.InsideWidth = varSize(0)
Me.InsideHeight = varSize(1)

End If

End Sub
 
Whell Brendan

This thing can also work in formLoad event and on runtime.

In fact the size is diterme only at runtime and not on FormOpen event.

The problem is that this form is dialog and that whats limit me from doing
it

how can i change it when the form is dialog?
 
When you open a form using the acDialog argument, the code that opened the
form is paused until the form is closed or hidden. So if you want to open a
form using the acDialog argument, and later change the size (or any other
property) of that form, you will have to do it from code behind that form,
as that is the only code that will run until the form is closed or hidden.

What is it that determines the size of the form?
 
Back
Top