Adjusting the main form height

  • Thread starter forcefield via AccessMonster.com
  • Start date
F

forcefield via AccessMonster.com

Hi,
I have a main form with 3 subforms. The main form opens with 2nd and 3rd
subforms hidden. The main form height was initially adjusted to accommodate
1st subform only
There is no problem with this.

Private Sub Form_Open(Cancel As Integer)

InsideHeight = 5000 'set the height of main form on opening
InsideWidth = 13700

Blah Blah
End Sub


When I click a particular field txtPhyQty ( > 0) in a first subform, I want
the main form’s height to extend automatically so as to accommodate the 2nd
and 3rd subforms. Nothing happens here.

Private Sub txtPhyQty_GotFocus()

If Nz(Me.txtPhyQty) > 0 Then

InsideHeight = 9400 'set the height of main form <- - fail
InsideWidth = 13700 ' set width of main form

Blah Blah
End if

End sub

Does anyone know how to solve this problem?
Thank you
 
S

Stuart McCall

forcefield via AccessMonster.com said:
Hi,
I have a main form with 3 subforms. The main form opens with 2nd and 3rd
subforms hidden. The main form height was initially adjusted to
accommodate
1st subform only
There is no problem with this.

Private Sub Form_Open(Cancel As Integer)

InsideHeight = 5000 'set the height of main form on opening
InsideWidth = 13700

Blah Blah
End Sub


When I click a particular field txtPhyQty ( > 0) in a first subform, I
want
the main form's height to extend automatically so as to accommodate the
2nd
and 3rd subforms. Nothing happens here.

Private Sub txtPhyQty_GotFocus()

If Nz(Me.txtPhyQty) > 0 Then

InsideHeight = 9400 'set the height of main form <- - fail
InsideWidth = 13700 ' set width of main form

Blah Blah
End if

End sub

Does anyone know how to solve this problem?
Thank you

Your code is running in the first subform, not the main form, so you need to
qualify which form's methods you're calling, ie:

Me.Parent.Form.InsideHeight
Me.Parent.Form.InsideWidth
 
S

Stuart McCall

Oops. Slight correction:
Your code is running in the first subform, not the main form, so you need
to qualify which form's methods you're calling, ie:

Me.Parent.Form.InsideHeight
Me.Parent.Form.InsideWidth

I meant to say "you need to qualify which form's properties you're setting"
 
D

David H

Have you considered using a Tab Control where each subform is placed on its
own tab? Quite effective.
 
F

forcefield via AccessMonster.com

Thank you both of you. I have tried Forms! frmMain.Insideheight= 9400 and it
works . I guess stuart's method should work also.
David, you gave a very suggestion. I will consider it as I move along .
 
F

forcefield via AccessMonster.com

Thank you both of you. I have tried Forms! frmMain.Insideheight= 9400 and it
works . I guess stuart's method should work also.
David, you gave a very suggestion. I will consider it as I move along .
 
F

forcefield via AccessMonster.com

Thank you both of you. I have tried Forms! frmMain.Insideheight= 9400 and it
works . I guess stuart's method should work also.
David, you gave a very suggestion. I will consider it as I move along .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top