E
Eric D. Braden
I am trying to resize a subform as data is entered into it. The
subform is, in its entirety, just one combo box that multiplies for
each record. I have it set now so that if there are no appropriate
records in the table associated with the subform, it just shows a
blank record (with the asterisk) for the user to select from the combo
box.
As the user selects items, the subform should grow so that each record
is shown. I wrote this little bit of code that seems to work
reasonably well, though I haven't figured out the best event to
associate it with to be sure it runs when I want it to.
RecCount = DCount("CaseModID", "t_CaseMod", "CaseID =
Forms.f_CaseEdit.CaseID")
Me.sub_CaseMod.Height = RecCount * 300 + 300
End If
This does what I want it to, except for one thing. The first record a
user inserts disappears upward (I have the scrollbars disabled).
After that, it looks great, showing all current records, plus the
blank "add new" record and growing correctly. If I have the code in
the Current of the form it will display correctly if you move to
another record and then back. It also appears correctly if I tie it
to a button. If I add an extra dead space of 300 twips at the
beginning with an If RecCount<1 statement, it just moves the same
errant behavior the second record and maintains the extra dead space
at the bottom.
Has anyone experienced this behavior? Is this simply a matter of me
placing the code with the appropriate event? I have tried it with
dirty, before update, after update, on change, and even on mouse move
and it repeats this behavior.
Any help is greatly appreciated.
Eric B
subform is, in its entirety, just one combo box that multiplies for
each record. I have it set now so that if there are no appropriate
records in the table associated with the subform, it just shows a
blank record (with the asterisk) for the user to select from the combo
box.
As the user selects items, the subform should grow so that each record
is shown. I wrote this little bit of code that seems to work
reasonably well, though I haven't figured out the best event to
associate it with to be sure it runs when I want it to.
RecCount = DCount("CaseModID", "t_CaseMod", "CaseID =
Forms.f_CaseEdit.CaseID")
Me.sub_CaseMod.Height = RecCount * 300 + 300
End If
This does what I want it to, except for one thing. The first record a
user inserts disappears upward (I have the scrollbars disabled).
After that, it looks great, showing all current records, plus the
blank "add new" record and growing correctly. If I have the code in
the Current of the form it will display correctly if you move to
another record and then back. It also appears correctly if I tie it
to a button. If I add an extra dead space of 300 twips at the
beginning with an If RecCount<1 statement, it just moves the same
errant behavior the second record and maintains the extra dead space
at the bottom.
Has anyone experienced this behavior? Is this simply a matter of me
placing the code with the appropriate event? I have tried it with
dirty, before update, after update, on change, and even on mouse move
and it repeats this behavior.
Any help is greatly appreciated.
Eric B