Solved SubForm - Count true False (1 Viewer)

Harry Taylor

Registered User.
Local time
Today, 16:03
Joined
Jul 10, 2012
Messages
71
Hi, I hope you can help.

I have a Subform (SQteTbl) on my 'Heatmaster' main page which shows customers quotes we've sent

SQteTbl has a True/False field, 'Ordered' - This is ticked when a customer places his order (so some records may have e.g 3 ticked, two unticked).

I want a conditional format text box on the form which will highlight any quotes outstanding (any one of the 'Ordered' boxes is False).

I am fine with the conditional formatting but am struggling with the argument to show quotes outstanding.

My mainform textbox currently is - =[SQteTbl subform].[Form]![Ordered]=False

Any ideas?

Thanks in advance :)
 

GPGeorge

Grover Park George
Local time
Today, 08:03
Joined
Nov 25, 2004
Messages
1,873
Did you try putting that expression in the Conditional Formatting dialog for this textbox control?

What was the result? One of the best trouble-shooting techniques is just "try it and see what happens". And try a different approach if necessary until you get the result needed.
 

June7

AWF VIP
Local time
Today, 07:03
Joined
Mar 9, 2014
Messages
5,472
Expression is in ControlSource? Syntax works for me.

Exactly what is the "issue" you encounter?

What exactly does "(so some records may have e.g 3 ticked, two unticked)" mean? If there is only the one yes/no field, how could a record have 3 ticked?
 
Last edited:

Harry Taylor

Registered User.
Local time
Today, 16:03
Joined
Jul 10, 2012
Messages
71
Did you try putting that expression in the Conditional Formatting dialog for this textbox control?

What was the result? One of the best trouble-shooting techniques is just "try it and see what happens". And try a different approach if necessary until you get the result needed.
Hi GPGeorge,
almost . . . definitely closer.
Only problem is when there is no record (blank subform) its it acting like its a false, so highlighting oragnge.

I need to use the Excel formula - If "","",
 

June7

AWF VIP
Local time
Today, 07:03
Joined
Mar 9, 2014
Messages
5,472
Why do you say Excel formula? In Access the function is IIf().
 

mike60smart

Registered User.
Local time
Today, 16:03
Joined
Aug 6, 2017
Messages
1,905
Hi GPGeorge,
almost . . . definitely closer.
Only problem is when there is no record (blank subform) its it acting like its a false, so highlighting oragnge.

I need to use the Excel formula - If "","",
I think we need to see a copy of the database.
 

Harry Taylor

Registered User.
Local time
Today, 16:03
Joined
Jul 10, 2012
Messages
71
Thank you for your replies. I'll battle on, I'm sure I'll get there :)
(Hopefully)
 

jdraw

Super Moderator
Staff member
Local time
Today, 11:03
Joined
Jan 23, 2006
Messages
15,379
Harry,
Can you supply more context info, or a copy of the db as Mike suggested?
 

Harry Taylor

Registered User.
Local time
Today, 16:03
Joined
Jul 10, 2012
Messages
71
I cant supply the DB as it contains 'sensative' info.

I have a subform - SQteTbl
When we quote customers a new line is added, so SQteTbl can have many rows.
When they order, the row remains but is ticked as ordered.
I want to conditional format a text box orange when there are un-ticked rows.

Ordered True or False.jpg


The conditional formatting I'm using is - SQteTbl subform].[Form]![Ordered]=Yes

However this is not looking at all rows AND new records (so no rows / ticks) is also showing orange
 

mike60smart

Registered User.
Local time
Today, 16:03
Joined
Aug 6, 2017
Messages
1,905
Is this what you want to see?
 

Attachments

  • Ordered.jpg
    Ordered.jpg
    42 KB · Views: 63

June7

AWF VIP
Local time
Today, 07:03
Joined
Mar 9, 2014
Messages
5,472
You could make copy of db and scrub it to remove sensitive data.
 

Gasman

Enthusiastic Amateur
Local time
Today, 16:03
Joined
Sep 21, 2011
Messages
14,306
See here for code to obfuscate your data
 

Mike Krailo

Well-known member
Local time
Today, 11:03
Joined
Mar 28, 2020
Messages
1,044
I have an example for you to look at and see if this does what you want. This adds a calculated text box in the footer of the subform that counts the number of unchecked Orders. This value is then used in the main form text box called txtNotOrdered and on top of that is a label called OrdersLabel to show some text in addition to the formatting rule. There is some code that updates this text box and label in the On Load and On Current events to keep it updated.

1688824986712.png
 

Attachments

  • OustandingQuotes.accdb
    1.2 MB · Views: 69
Last edited:

Harry Taylor

Registered User.
Local time
Today, 16:03
Joined
Jul 10, 2012
Messages
71
I have an example for you to look at and see if this does what you want. This adds a calculated text box in the footer of the subform that counts the number of unchecked Orders. This value is then used in the main form text box called txtNotOrdered and on top of that is a label called OrdersLabel to show some text in addition to the formatting rule. There is some code that updates this text box and label in the On Load and On Current events to keep it updated.

View attachment 108754

Mike,
Thank you so much, that's exactly what I'm looking for. Very Much appreciated !!
 

Harry Taylor

Registered User.
Local time
Today, 16:03
Joined
Jul 10, 2012
Messages
71
Solved
For any others requiring this function

Created a txtbox(Text14) in the subform footer - =Count(IIf([Ordered]=False,0))

On the main for txtbox - =[SQteTbl subform]![Text14]

Big thanks to Mike Krailo, massive help :)
 

Users who are viewing this thread

Top Bottom