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