deko wrote:
I have two subforms within a particular form. The one on top is a datasheet
of transactions; the one on the bottom is a summary of totals. I would like
to have the datasheet fill the entire parent form until a command button is
clicked, then have the datasheet form shrunk to half it's original height
and have the totals summary form appear below it. The totals summary sheet,
then, would not be visible until the command button is clicked, and would
reside behind the datasheet form in it's invisible state. I've tried
setting the window height property, but I get an error telling me it's a
read only property.
Has anyone done something like this before?
thanks in advance...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Sounds like you have 2 subforms in a main form, correct?
You'd just modify the subform Control's left, top, width and height
properties - that will change the size of the subform controls on the
main form. You could also set up the subforms so they are both the
same size & cover the same area on the main form (not recommended by
Microsoft, but sometimes useful) & use the subform Visible property to
hide one and display the other.
E.g.: Main form name = "frmMain"
Subform 1 name = "sfrmTotals"
Subform 2 name = "sfrmTransactions"
To hide sfrmTotals - VBA code in frmMain:
Private Sub cmdTotals_Click()
Me!sfrmTransactions.Visible = False
Me!sfrmTotals.Visible = True
End Sub
You'd have to have another button that does the reverse - or - you
could make the same button do the work for both like this:
Private Sub cmdTotals_Click()
Static fTotals as Boolean
' First time thru fTotals will become True
fTotals = Not fTotals
If fTotals Then
me!cmdTotals.Caption = "Totals"
Else
me!cmdTotals.Caption = "Transactions"
End If
Me!sfrmTotals.Visible = fTotals
Me!sfrmTransactions.Visible = not fTotals
End Sub
The beginning state of the form should be showing transactions. When
the CommandButton "Totals" is clicked it will flip the fTotals boolean
(change it to its opposite), change the caption of the CommandButton,
and hide the subforms according to the new state.
Be sure to test this since I sometimes get the states mixed up - just
make sure that when the CommandButton caption = "Totals" that the
Totals subform is showing and vice-versa. To fix just move the "NOT"
from one .Visible assignment to the other until it looks correct.
HTH,
MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBP4ZapYechKqOuFEgEQJU8gCgxsfdiAV9ml6wEi34NoWfXA WrXqEAoP1o
mCv/1TlUD3sXcbQ6RtPtGzaL
=UsF6
-----END PGP SIGNATURE-----