473,508 Members | 2,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting conditional formatting on the top values in a series of columns in a single record

I am working on a sales report where I show weekly sales by category
for each of the 52 weeks in the year. Each record in my table/report
has the 52 weeks of sales in it. I want to highlight to top five weeks
of sales for each category by using a conditonal format to highlight
these top five weeks. I've been trying to find a way to do this but
have not been sucessful looking through many books on Access and in
reading the user groups. If anyone has any suggestions, I would be
very happy to hear them.

Chuck
Nov 13 '05 #1
3 2292
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In the report's OnOpen procedure I'd run a separate query, on the same
data, that used the TOP 5 statement in the SELECT clause & ORDER BY
<numeric value field> DESC. I'd save the "bottom" of the top 5 values
in a report variable and in the conditional formatting function I'd
compare the saved value to the current record value:

If current_value >= saved_value Then highlight record

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQX4AmIechKqOuFEgEQLiuQCbBYrO2X2jZcWhFf2eyNUc/69lQlEAn3u5
qpaJQ6Xez79rreAvfzALcV7D
=FzNW
-----END PGP SIGNATURE-----
Chuck Reed wrote:
I am working on a sales report where I show weekly sales by category
for each of the 52 weeks in the year. Each record in my table/report
has the 52 weeks of sales in it. I want to highlight to top five weeks
of sales for each category by using a conditonal format to highlight
these top five weeks. I've been trying to find a way to do this but
have not been sucessful looking through many books on Access and in
reading the user groups. If anyone has any suggestions, I would be
very happy to hear them.


Nov 13 '05 #2
Thanx for your post. I understand the logic of how to make the
conditional formatting work for me from your example. That will work
great. However, what I don't understand how to do is to run a Top 5 on
a table or query where the data by week is all in the same record
rather than in individual records. Below is the query that I'm working
off of:

SELECT Top25_2003.Store, Top25_2003.Description, Top25_2003.Sales,
Top25_2003.[1], Top25_2003.[2], Top25_2003.[3], Top25_2003.[4],
Top25_2003.[5], Top25_2003.[6], Top25_2003.[7], Top25_2003.[8],
Top25_2003.[9], Top25_2003.[10], Top25_2003.[11], Top25_2003.[12],
Top25_2003.[13], Top25_2003.[14], Top25_2003.[15], Top25_2003.[16],
Top25_2003.[17], Top25_2003.[18], Top25_2003.[19], Top25_2003.[20],
Top25_2003.[21], Top25_2003.[22], Top25_2003.[23], Top25_2003.[24],
Top25_2003.[25], Top25_2003.[26], Top25_2003.[27], Top25_2003.[28],
Top25_2003.[29], Top25_2003.[30]
FROM Top25_2003
WHERE (((Top25_2003.Store)=getstore()))
ORDER BY Top25_2003.Store, Top25_2003.Sales DESC;

What I'm wanting to do is within the same record, identify the top 5
weeks of the 30 weeks displayed in one record. I understand how to use
the top values if the weeks were in individual records (vertically in
a table). But I do not know how to identify the same type of top value
logic with in a series of columns in the same record.

In my case, I want to highlight the the five highest sales weeks in
the series of columns Top25_2003.[1] through Top25_2003.[30]. If you
have any ideas on how to do that, I would be very appreciative to
receive such help.

Chuck

MGFoster <me@privacy.com> wrote in message news:<4h*****************@newsread1.news.pas.earth link.net>...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In the report's OnOpen procedure I'd run a separate query, on the same
data, that used the TOP 5 statement in the SELECT clause & ORDER BY
<numeric value field> DESC. I'd save the "bottom" of the top 5 values
in a report variable and in the conditional formatting function I'd
compare the saved value to the current record value:

If current_value >= saved_value Then highlight record

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQX4AmIechKqOuFEgEQLiuQCbBYrO2X2jZcWhFf2eyNUc/69lQlEAn3u5
qpaJQ6Xez79rreAvfzALcV7D
=FzNW
-----END PGP SIGNATURE-----
Chuck Reed wrote:
I am working on a sales report where I show weekly sales by category
for each of the 52 weeks in the year. Each record in my table/report
has the 52 weeks of sales in it. I want to highlight to top five weeks
of sales for each category by using a conditonal format to highlight
these top five weeks. I've been trying to find a way to do this but
have not been sucessful looking through many books on Access and in
reading the user groups. If anyone has any suggestions, I would be
very happy to hear them.

Nov 13 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Looks like you've got a table in "spreadsheet mode," or the data source
"Top25_2003" is a cross-tab query. Not what I was expecting when I gave
my solution, which means a more complicated solution.

In this new case I'd put something in the Detail section OnPrint event
procedure (you are printing each record in the Detail section, aren't
you?) that'd find the top 5 values in fields [1] thru [30]. Then get
the minimum value of those top 5. Then go thru the fields again, this
time comparing each field value to the minimum of the top 5 values. If
any of the field values is less-than or equal to the minimum of the top
5 values I'd highlight that field, probably using the control's
BackgroundColor or FontWeight properties.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQYE02YechKqOuFEgEQK0ogCffWb2RqlngwQe5L2JwABuP3 GVl18AnRns
EJXZ2cyBfY1Jjrsufpfj59Fz
=QCcr
-----END PGP SIGNATURE-----
Chuck Reed wrote:
Thanx for your post. I understand the logic of how to make the
conditional formatting work for me from your example. That will work
great. However, what I don't understand how to do is to run a Top 5 on
a table or query where the data by week is all in the same record
rather than in individual records. Below is the query that I'm working
off of:

SELECT Top25_2003.Store, Top25_2003.Description, Top25_2003.Sales,
Top25_2003.[1], Top25_2003.[2], Top25_2003.[3], Top25_2003.[4],
Top25_2003.[5], Top25_2003.[6], Top25_2003.[7], Top25_2003.[8],
Top25_2003.[9], Top25_2003.[10], Top25_2003.[11], Top25_2003.[12],
Top25_2003.[13], Top25_2003.[14], Top25_2003.[15], Top25_2003.[16],
Top25_2003.[17], Top25_2003.[18], Top25_2003.[19], Top25_2003.[20],
Top25_2003.[21], Top25_2003.[22], Top25_2003.[23], Top25_2003.[24],
Top25_2003.[25], Top25_2003.[26], Top25_2003.[27], Top25_2003.[28],
Top25_2003.[29], Top25_2003.[30]
FROM Top25_2003
WHERE (((Top25_2003.Store)=getstore()))
ORDER BY Top25_2003.Store, Top25_2003.Sales DESC;

What I'm wanting to do is within the same record, identify the top 5
weeks of the 30 weeks displayed in one record. I understand how to use
the top values if the weeks were in individual records (vertically in
a table). But I do not know how to identify the same type of top value
logic with in a series of columns in the same record.

In my case, I want to highlight the the five highest sales weeks in
the series of columns Top25_2003.[1] through Top25_2003.[30]. If you
have any ideas on how to do that, I would be very appreciative to
receive such help.

Chuck

< SNIP PREVIOUS POSTS >

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8909
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another...
3
5920
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
4
3115
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the...
1
2231
by: WindAndWaves | last post by:
Hey Folks I seem to be asking millions of questions. Truth is, I just discovered this awesome research and having been typing by myself for years the questions are all coming out. Here is...
8
12010
by: Dimitri Furman | last post by:
Given: Access 2002/2003 A subform in datasheet or continuous view, placed on a tab page (this last may or may not matter) Conditional formatting applied to some controls on the subform - format...
12
2337
by: dmieluk | last post by:
Problem: When moving between records, I need to control which combo/text boxes are displayed on the current form, dependent upon data in the current record. More: I building my first...
2
2337
by: jodyblau | last post by:
I'm not certain that what I am trying to do is possible; in any event I haven't been able to figure it out. Here is what I am trying to do: I have one table that has a list of cases I'm working...
4
8918
by: slinky | last post by:
Thanks in advance... I have a continuous style form with a field for each record called "STATUS". I simply want to have the form load and if the value of the textbox is "Inactive" I want the...
10
9645
by: afromanam | last post by:
Regards, Please help What I'm trying to do is this: (and I can't use reports since I must export to Excel) I export some queries to different tabs in an excel workbook I then loop through...
0
7135
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7410
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.