Please help - hiding fields

Tracy

Registered User.
Local time
Today, 20:30
Joined
Oct 19, 2001
Messages
71
I have a report with a group header of Branch. In here I have a load of fields (obviously), but depending on various criteria, I want to hide some of the fields for a particular branch but show them for others.

I've tried to do this on the GroupHeader_Format event, but it just hides whatever I hide for the last branch, for all branches.

Does anyone know how I can hide fields for say Branch 1 and Branch 3 but show them for Branch 2 and 4 and 5?

Many thanks
Tracy
 
Branch 1, Branch 2, ...Branch 5 ???

Your data is not normalised and it is this that is causing your problems.

Search this forum and the web for normalising...
 
I've probably not explained very well. My data is normalised no problem. WHy do you think it isn't?

I just have a report which is grouped on Branch, but when I hide the fields for the first grouping, say Branch 1, it only hides those fields which I choose to hide the fifth time round when calculating for Branch 5.

So for Branch 1 I just want to hide field1, but for Branch 2,3,4,5 I want to hide field1 and field2. If I do this then field2 also ends up being hidden for Branch1.

Does this make sense?
Thanks
Tracy
 
Tracy said:
I've probably not explained very well. My data is normalised no problem. WHy do you think it isn't?

Becasue I, by scanning and not reading, thought you were referring to field names Branch1 through 5 which is a repeating group and, therefore, bad design.

I don't use reports so I don't know. :(
 
Think you may need an Event Procedure for the On Format property

Basically it runs something like
Tip. Ensure all fields are set to visible to start with


if [Branch]=1 then
field 1.visible=false
field 5.visible=false
etc
elseif
if [Branch]=2 then
field 4.visible=false
field 5.visible=false
etc
elseif
etc


end if

Haven't tried it but it may be worth a test

good luck

Len B
 
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim ctrl As Control
For Each ctrl In Me.Controls
If IsNull(ctrl) Then
ctrl.Visible = False
Else
ctrl.Visible = True
End If
Next
Set ctrl = Nothing
End Sub
 
Thanks Len and Rich, Rich, I have exactly your code, but it just formats sooooo bizarrely. WHen I put breakpoints in the code, it formats for branch1, then branch2, branch3, then branch3 again.

My code wants to hide fields for Branch 3 only, but because it formats for branch 3 before it actuallty displays that page. So branch3 appears on page2, but because this is the last branch to be formatted before the report is displayed, branch1 and branch2 (on page1) take the formatting for branch3 and so hides the fields for branch1 and branch2.

I think there are a lot of bugs in access reports. They do not format consistently nor as you'd expect. I'd expect each page to be formatted once, but this clearly doesn't happen. This causes totals to screw up aswell.

Any help would be appreciated, but it seems noone really knows how it all works. Maybe I need to call MS?!!!!

Thanks for all the help
Tracy
 

Users who are viewing this thread

Back
Top Bottom