IF..THEN and Hiding Rows

S

Sol

I am using IF..THEN and FontBold in the On Format property
of a detail in a tabular report to make certain rows
(based on one field) bold. I am writing seperae IF...THEN
looping constructs for each field in the row. Is there a
way to consolidate this code into one IF..THEN statement
and make it run faster? This is what it looks like:

If [Text1] = "X" Then
[Text1]FontBold = True
Else
[Text1].FontWeight = False
End If

If [Text1] = "X" Then
[Text2]FontBold = True
Else
[Text2].FontWeight = False
End If

And so on....

Also, is there a way to us IF..THEN to make fields in
Detail section Hidden and Shrunken, so their row space
does not show. These fields are linked to a sub report
but I don't want them shown in the main report detail.

Thanks
 
F

fredg

Sol said:
I am using IF..THEN and FontBold in the On Format property
of a detail in a tabular report to make certain rows
(based on one field) bold. I am writing seperae IF...THEN
looping constructs for each field in the row. Is there a
way to consolidate this code into one IF..THEN statement
and make it run faster? This is what it looks like:

If [Text1] = "X" Then
[Text1]FontBold = True
Else
[Text1].FontWeight = False
End If

If [Text1] = "X" Then
[Text2]FontBold = True
Else
[Text2].FontWeight = False
End If

And so on....

Also, is there a way to us IF..THEN to make fields in
Detail section Hidden and Shrunken, so their row space
does not show. These fields are linked to a sub report
but I don't want them shown in the main report detail.

Thanks
1) As long as both controls use the same criteria, just combine them in
the same If .. then statement.
Note: You're mixing properties and their values.
FontWeight = False is not a valid value for the FontWeight property.

If [Text1= = X Then
[Text1].FontBold = True
[Text2].FontBold = True
Else
[Text1].FontBold = False
[Text2].FontBold = False
End if

2) You can set a control's CanShrink property to Yes.
If the control is null, the control under it will move up PROVIDED there
is no other control on that same line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top