Join smaller report on the back of main report?

XelaIrodavlas

Registered User.
Local time
Today, 21:38
Joined
Oct 26, 2012
Messages
175
Hi all,

Apologies if I'm being dim but I need some ideas on the best way to solve my problem:

I have a report that displays incidents, their details, consequences and a photo. Among the details is a severity rating high medium or low, I have been asked to make the report shorten the records which have been given a low severity (because it takes up as much space as the more important/severe ones).

The only method I can think of is to use the onformat event, to shrink and make invisible all the fields that I don't want to see if the severity field shows 'low' - but given the amount of code this will require it doesn't seem like a terribly efficient way to do it.

Am I just being thick? is there an easier way to do this (maybe some kind of subform?) or do I just need to man-up and start typing?

Thanks in advance :)
 
Besides a sub form, you could try the TAG property. I think you can select (control click on them) all the objects at once, then enter the value such as "Hide" in the TAG property (Properties window of the control) and then that will give that same value to all the controls you want to have hidden or shrunk. Then in the vba use the code to loop through all the controls and it will change them all. Here is an example:

http://snipplr.com/view/14121/

I have to disclose I haven't actually tried it myself as haven't had the occasion to do your particular task.
 
Well I've been a little distracted by other jobs but I've had a little play and thanks for the tip :) I've used the tag property to group them all, and have told them all to disappear when the severity is low (see code).

But a new problem has arisen, for some reason it happens on every record as long as one of them contains low severity UNLESS I specify an 'else' to the initial if (again see code), this is fine except all the members of group1 then get put in the same space and size
- so, is there a way to tell the controls to default to their original size and positions (as stated in design view)?

Any and all help is appreciated :)

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Text42 = "Low" Then
Dim ctl

For Each ctl In Me.Controls
If ctl.Tag = "Group1" Then
ctl.Visible = False
ctl.Top = 0
ctl.Left = 0
ctl.Height = 100
ctl.Width = 100
End If
Next
Else

For Each ctl In Me.Controls
If ctl.Tag = "Group1" Then
ctl.Visible = True
ctl.Top = 100
ctl.Left = 100
ctl.Height = 3000
ctl.Width = 3000
End If
Next
End If
End Sub

edit: i feel like i explained that badly: the issue is that all instances of group1 controls were disappearing, even if they had a high severity. This was somehow solved by adding the second half of the if function shown above, explicitly specifying a new else that said it IS visible and it IS in a different location. This puts all of the controls on top of eachother, so I want to be able to tell Group1 objects to default to original location... Hope that explains...
 
Just as I thought, I was being dim.

If i make two reports for the high/Low severity cases, I can just put them both in as separate sub-reports so one prints after the other. Can anyone think why that wont work? otherwise I think it's cracked and I just wasted two hours learning pointless vba...

Oh well :)
 

Users who are viewing this thread

Back
Top Bottom