using report code builder

ariel81

Registered User.
Local time
Today, 13:33
Joined
Dec 31, 2006
Messages
75
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.
 
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:

Code:
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
 

Users who are viewing this thread

Back
Top Bottom