• ** There has been a recent site upgrade. Please clear your browser cache to avoid issues. **
  • New forum feature - post voting and best solution

    Check out this thread for the details: https://www.access-programmers.co.uk/forums/threads/new-forum-feature-post-voting-and-best-answer.314134/

    This new feature looks great to me! :)

  • We now have 3 forum themes

    Go for the default (light) theme, Shades of Grey or Shades of Blue. I just added the Blue one.

    The thread about it is here: https://www.access-programmers.co.uk/forums/threads/new-forum-theme-shades-of-blue.314136/

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

kellygirl

New member
Local time
Today, 05:17
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
Today, 02:17
Joined
Aug 30, 2003
Messages
34,598
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, 05:17
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
Today, 02:17
Joined
Aug 30, 2003
Messages
34,598
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, 05:17
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
Today, 02:17
Joined
Aug 30, 2003
Messages
34,598
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
Today, 02:17
Joined
Aug 30, 2003
Messages
34,598
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, 05:17
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
Today, 02:17
Joined
Aug 30, 2003
Messages
34,598
Glad you got it sorted out!
 

Users who are viewing this thread

Top Bottom