Hey folks - Anyone have an answer to this?
I have several subforms that open on a main form. The height for each of the subforms are set based on the number of records in that subform. What I'm trying to do is position each the subforms on the mainform so that none overlap each other.
Problem is I cant find the proper control for each of the forms to position them on the main form, I can get the height of each form, which are based on a "twips" measurement. How do you set the top postion of the subforms?
here is some of the code I have so far:
'Main Form
Private Sub Form_Open(Cancel As Integer)
Dim x As Integer, y As Integer, z As Integer
Dim Hgt As Integer
Hgt = 500
'These globals ExpHgt,WklyHgt,SavHgt can be seen here: all have values
x = ExpHgt
y = WklyHgt
z = SavHgt
'This sets the height of the main form so all the subforms can fit within it
Me.InsideHeight = Hgt * 2 + x + y + z + Me.FormHeader.Height + Me.FormFooter.Height
'This works.. so I know my syntax is right
Me![FRM_SAVINGS].Form.Visible = True
'trying to set postion of bottom form: This dont work - object defined error on .Top
Me![FRM_SAVINGS].Form.Top = x + Hgt + y + Hgt
End Sub
'one of my subforms - FRM_SAVINGS
Private Sub Form_Open(Cancel As Integer)
Dim RecCnt As Integer, Hgt As Integer
Hgt = 500
RecCnt = Me.RecordsetClone.RecordCount
'Set the height of the form
Me.Form.InsideHeight = Hgt * RecCnt + Me.FormHeader.Height + Me.FormFooter.Height
'Post the height on the global variable
SavHgt = Me.Form.InsideHeight
End Sub
The .Top control is not available, thought of using .grid y, but thats on a different measuring system and wont work on the main form anyway.
Any ideas to fix this issue?
- Thanks
I have several subforms that open on a main form. The height for each of the subforms are set based on the number of records in that subform. What I'm trying to do is position each the subforms on the mainform so that none overlap each other.
Problem is I cant find the proper control for each of the forms to position them on the main form, I can get the height of each form, which are based on a "twips" measurement. How do you set the top postion of the subforms?
here is some of the code I have so far:
'Main Form
Private Sub Form_Open(Cancel As Integer)
Dim x As Integer, y As Integer, z As Integer
Dim Hgt As Integer
Hgt = 500
'These globals ExpHgt,WklyHgt,SavHgt can be seen here: all have values
x = ExpHgt
y = WklyHgt
z = SavHgt
'This sets the height of the main form so all the subforms can fit within it
Me.InsideHeight = Hgt * 2 + x + y + z + Me.FormHeader.Height + Me.FormFooter.Height
'This works.. so I know my syntax is right
Me![FRM_SAVINGS].Form.Visible = True
'trying to set postion of bottom form: This dont work - object defined error on .Top
Me![FRM_SAVINGS].Form.Top = x + Hgt + y + Hgt
End Sub
'one of my subforms - FRM_SAVINGS
Private Sub Form_Open(Cancel As Integer)
Dim RecCnt As Integer, Hgt As Integer
Hgt = 500
RecCnt = Me.RecordsetClone.RecordCount
'Set the height of the form
Me.Form.InsideHeight = Hgt * RecCnt + Me.FormHeader.Height + Me.FormFooter.Height
'Post the height on the global variable
SavHgt = Me.Form.InsideHeight
End Sub
The .Top control is not available, thought of using .grid y, but thats on a different measuring system and wont work on the main form anyway.
Any ideas to fix this issue?
- Thanks
