View Single Post
  #7  
Old November 23rd, 2005, 05:20 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to add visible criteria to text box?

First, I would like to go on record as suggesting that if you have columns
with some being all null/empty, I would question your table structure. I
don't think this sounds normalized. However, since this is the Thanksgiving
season, try this solution.

Making some assumptions:

-your columns are all the same width
Labels and text boxes

-You have a Report Header section with
text boxes for each column.
Names: txtCount1 - txtCount10
Control Source: = Count([Field1]) to =Count([Field10])

-The column labels are in the Page Header
Names: Label1 to Label10

-The text boxes in the detail section
Names: txt1 to txt10

-You add a text box to the detail section
Name:txtRunningSum
Control Source: =1
Running Sum: Over All

Your code would look like:

Private Sub Detail_Format( _
Cancel As Integer, FormatCount As Integer)
Dim i As Integer
Dim j As Integer
Dim intCtlWidth As Integer
If Me.txtRunningSum = 1 Then
intCtlWidth = Me.txt1.Width
For i = 10 To 1 Step -1
If Me("txtCount" & i) = 0 Then
Me("txt" & i).Visible = False
For j = i To 10
Me("txt" & j).Left = _
Me("txt" & j).Left - _
intCtlWidth
Next
End If
Next
End If
End Sub

Private Sub PageHeaderSection_Format( _
Cancel As Integer, FormatCount As Integer)
Dim i As Integer
Dim j As Integer
Dim intCtlWidth As Integer
intCtlWidth = Me.txt1.Width
For i = 10 To 1 Step -1
If Me("txtCount" & i) = 0 Then
Me("Label" & i).Visible = False
For j = i To 10
Me("label" & j).Left = _
Me("Label" & j).Left - _
intCtlWidth
Next
End If
Next

End Sub

--
Duane Hookom
MS Access MVP


"ida" wrote in message
oups.com...
Ignore the previous post, I found what you were talking about. I am
going to try to find out what commands are needed to set properties of
specific text boxes.


ida wrote:
Thanks Duane for the help. Unfortunately, I can't seem to find the ON
FORMAT option when I right click on a text box in the design view of a
report. Am I accessing it incorrectly? Or do I directly code into the
report?