Is thier a better way to condense this code then to have read the same way
over and over each time? I have 5 sets of these and each field is set to be
visible if the option box has a check mark in it. I am only showing you one
full set for the "IsDisplayHistoricalGrowth" option box. If sthere is an
eaier way to do this could someone let me know. I am pretty new at this.
Below is fired via the optionbox IsDisplayHistoricalGrowth
Me.[YearFromHistoricalGrowth].Visible =
Nz(Me.[IsDisplayHistoricalGrowth], True)
Me.[YearToHistoricalGrowth].Visible =
Nz(Me.[IsDisplayHistoricalGrowth], True)
Me.[OneMileHistoricalGrowth].Visible =
Nz(Me.[IsDisplayHistoricalGrowth], True)
Me.[ThreeMileHistoricalGrowth].Visible =
Nz(Me.[IsDisplayHistoricalGrowth], True)
Me.[FiveMileHistoricalGrowth].Visible =
Nz(Me.[IsDisplayHistoricalGrowth], True)
BeWyched - 12 Jul 2007 17:58 GMT
Try:
Dim flg as Boolean
flg = Nz(Me.[IsDisplayHistoricalGrowth], True)
With Me
.[YearFromHistoricalGrowth].Visible = flg
.[YearToHistoricalGrowth].Visible = flg
.[OneMileHistoricalGrowth].Visible = flg
.[ThreeMileHistoricalGrowth].Visible = flg
.[FiveMileHistoricalGrowth].Visible = flg
End With
> Is thier a better way to condense this code then to have read the same way
> over and over each time? I have 5 sets of these and each field is set to be
[quoted text clipped - 13 lines]
> Me.[FiveMileHistoricalGrowth].Visible =
> Nz(Me.[IsDisplayHistoricalGrowth], True)
Alex Dybenko - 12 Jul 2007 18:02 GMT
Hi,
you can, for example set a Tag property for each set of textboxes, and loop
through all controls of a form, and depending on selected checkmark and tag
of each textbox - set Visible property
you can also try to use control's name, if they are similar like
"*HistoricalGrowth"

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> Is thier a better way to condense this code then to have read the same way
> over and over each time? I have 5 sets of these and each field is set to
[quoted text clipped - 15 lines]
> Me.[FiveMileHistoricalGrowth].Visible =
> Nz(Me.[IsDisplayHistoricalGrowth], True)