View Full Version : using report code builder


ariel81
03-11-2007, 09:21 PM
i have drawn 31 textboxes in report "detail" section. all the 31 textboxes were intitally set to invisible.

how to make the textboxes visible upon the report is open with reference to the respective month of "a control in a form"?

e.g:

jan to allow 31 textboxes visible in report
feb to allow 28 textboxes visible in report

how to use the report code builder to control the visible properties of the textboxes in the report?

thank you.

WayneRyan
03-11-2007, 09:44 PM
Ariel,

To make the textboxes visible/invisible will require code.

First, you'll have to name your textboxes systematically --> txtBox01, txtBox02, etc.

Then using an event like OnFormat for the header, put:


Dim i As Long
Dim MonthLength As Long

Select Case WhatMonth ' <-- Don't know where you get this value.
Case "Jan", "Mar", ...
MonthLength = 31
Case "Apr", "Jun", ...
MonthLength = 30
Case "Feb"
MonthLength = 28
End Select

For i = 1 to 1
If i <= MonthLength
Me.Controls("txtBox" & Format(i, "00").Visible = True
Else
Me.Controls("txtBox" & Format(i, "00").Visible = False
End If


hth,
Wayne