Label visible if one or more check boxes are checked (1 Viewer)

kellygirl

New member
Local time
Today, 02:04
Joined
Jun 18, 2015
Messages
8
Hi all,

I have a report for purchase orders. In the report, there is a checkbox (control source is OrderItemBarcode). If the item on a line is a chemical, the box gets checked as needing chemical inventory barcoding. I have a label on the report (lblProcessForBarcode) at the top of the form set as "Visible=No". If one or more of the checkboxes on the report are checked, the label should be visible. I thought I could just do something simple in the Current event of the report, but no. Of course, because it's Friday afternoon. This is what I have so far:

If Me.OrderItemBarcode = True Then
Me!lblProcessForBarcode.Visible = True
Else:
Me!lblProcessForBarcode.Visible = False
End If

Any assistance will be greatly appreciated.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:04
Joined
Aug 30, 2003
Messages
36,118
For a report in preview or print view, you'd want the format event of the section containing those controls.
 

kellygirl

New member
Local time
Today, 02:04
Joined
Jun 18, 2015
Messages
8
For a report in preview or print view, you'd want the format event of the section containing those controls.
This is for a report, so I am not sure what you mean by section, unless you mean headers? The label is in the page header. The checkbox is in the PONumber header... but then I don't find a format event. Can you tell me where to look, please?

The code worked when the "label" was a textbox, but then I was not able to format it the way it needed to be formatted.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:04
Joined
Aug 30, 2003
Messages
36,118
Normally the section is the detail section but for you it sounds like the page header. If you have the report in design view, you should see "On Format" as one of the properties of that section on the events tab. I'd also clean up your code to:

Code:
If Me.OrderItemBarcode = True Then
  Me.lblProcessForBarcode.Visible = True
Else
  Me.lblProcessForBarcode.Visible = False
End If
 

kellygirl

New member
Local time
Today, 02:04
Joined
Jun 18, 2015
Messages
8
I did find the "On Format" - but the code still doesn't work at this point. I'll check the usual culprits ... spelling, names, etc. and I'll work on it some more. Thank you for the code clean up.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:04
Joined
Aug 30, 2003
Messages
36,118
If you're still stuck, can you attach the db here? Also, make sure you're not using Report view. Different events fire.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:04
Joined
Aug 30, 2003
Messages
36,118
By the way, you might try the code in the section containing the data. The page header might be looking at a different record than you expect. I'm not sure offhand which it uses. You could use Debug.Print to test it.
 

kellygirl

New member
Local time
Today, 02:04
Joined
Jun 18, 2015
Messages
8
Ugggh - so after checking spelling and NAMES and SECTIONS (thank you for making me think of why the checkbox was in the page header) ... I realized my code referenced the "new" checkbox field in the "details" section of the report. The prior version of this report had a similar field (generalized for the entire report) in the page header.

What can I say, it's Friday afternoon. Thank you so, so much for your time and patience. Code works perfectly now!
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:04
Joined
Aug 30, 2003
Messages
36,118
Glad you got it sorted out!
 

Users who are viewing this thread

Top Bottom