By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,561 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Help creating a 'legend'

P: n/a
In one of my tables, in addition to a text field that is a Description
field, there are two fields for color formatting the data in reports.
They are Longs and hold the foreground and background color values that
the Description in that record should be displayed in. For example, the
following records might exist...
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
There could be any number of records, most likely 10-15 but could be
more or less.
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?

Sep 20 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
On Wed, 20 Sep 2006 17:14:43 -0400, Swans, What Swans?
<fz@barkingpumpkin.ooowrote:

I'm assuming you know how to create a subreport.
Then to color each field, write code in the OnFormat event. Something
like:
txtFishName.BackColor = BackColor
txtFishName.ForeColor = ForeColor

BackColor and ForeColor would be columns in your query that this
(sub)report is bound to.

-Tom.

>In one of my tables, in addition to a text field that is a Description
field, there are two fields for color formatting the data in reports.
They are Longs and hold the foreground and background color values that
the Description in that record should be displayed in. For example, the
following records might exist...
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
There could be any number of records, most likely 10-15 but could be
more or less.
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?
Sep 21 '06 #2

P: n/a
In article <j9********************************@4ax.com>, no.spam.tom7744
@cox.net says...
On Wed, 20 Sep 2006 17:14:43 -0400, Swans, What Swans?
<fz@barkingpumpkin.ooowrote:

I'm assuming you know how to create a subreport.
Then to color each field, write code in the OnFormat event. Something
like:
txtFishName.BackColor = BackColor
txtFishName.ForeColor = ForeColor

BackColor and ForeColor would be columns in your query that this
(sub)report is bound to.

-Tom.

In one of my tables, in addition to a text field that is a Description
field, there are two fields for color formatting the data in reports.
They are Longs and hold the foreground and background color values that
the Description in that record should be displayed in. For example, the
following records might exist...
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
There could be any number of records, most likely 10-15 but could be
more or less.
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?

I have actually considered a sub-report however the sizing is an issue.
How do I set it so that the report displays on the screen in the size I
want it? Cant get it to do what I want. AFAIK I have to have a print
driver for whatever printer is going to generate the report and then
find a paper size that I want to use, format it all to fit and it just
does not work. I have an area about 2=3F" wide to fit this legend. I
have yet to find a printer that supports 2=3F" paper width. I really may
be a total dumb ass on this and maybe I am missing something obvious,
but I need an answer that will be a universal fix w/o and requirements
such as a specific printer.
Sep 21 '06 #3

P: n/a
In article <j9********************************@4ax.com>, no.spam.tom7744
@cox.net says...
On Wed, 20 Sep 2006 17:14:43 -0400, Swans, What Swans?
<fz@barkingpumpkin.ooowrote:

I'm assuming you know how to create a subreport.
Then to color each field, write code in the OnFormat event. Something
like:
txtFishName.BackColor = BackColor
txtFishName.ForeColor = ForeColor

BackColor and ForeColor would be columns in your query that this
(sub)report is bound to.

-Tom.

In one of my tables, in addition to a text field that is a Description
field, there are two fields for color formatting the data in reports.
They are Longs and hold the foreground and background color values that
the Description in that record should be displayed in. For example, the
following records might exist...
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
There could be any number of records, most likely 10-15 but could be
more or less.
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?

Also, I was not aware you could put a subreport on a form. I hadnt ever
tried that. When I use the subform/report tool on a form all it allows
me to do is display a subform.
Sep 21 '06 #4

P: n/a
....assuming that these values are dynamic, I know of no "simple" way to do
this

....as always, when in need of doing something difficult, see www.lebans.com

....the SubClassFormatByCriteria sample mdb should give you what you need.

....hth

William Hindman

<Swans>; "What Swans?" <fz@barkingpumpkin.ooowrote in message
news:MP***********************@newsgroups.comcast. net...
In one of my tables, in addition to a text field that is a Description
field, there are two fields for color formatting the data in reports.
They are Longs and hold the foreground and background color values that
the Description in that record should be displayed in. For example, the
following records might exist...
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
There could be any number of records, most likely 10-15 but could be
more or less.
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?

Sep 21 '06 #5

P: n/a
On Thu, 21 Sep 2006 01:42:21 -0400, Swans, What Swans?
<fz@barkingpumpkin.ooowrote:

No you can't. I picked up on your "...two fields for color formatting
the data in reports..." and figured you wanted to create a report.
Upon second reading of your OP I am confused. You want color
formatting in reports, but the legend in a form???

-Tom.
>In article <j9********************************@4ax.com>, no.spam.tom7744
@cox.net says...
>On Wed, 20 Sep 2006 17:14:43 -0400, Swans, What Swans?
<fz@barkingpumpkin.ooowrote:

I'm assuming you know how to create a subreport.
Then to color each field, write code in the OnFormat event. Something
like:
txtFishName.BackColor = BackColor
txtFishName.ForeColor = ForeColor

BackColor and ForeColor would be columns in your query that this
(sub)report is bound to.

-Tom.

>In one of my tables, in addition to a text field that is a Description
field, there are two fields for color formatting the data in reports.
They are Longs and hold the foreground and background color values that
the Description in that record should be displayed in. For example, the
following records might exist...
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
There could be any number of records, most likely 10-15 but could be
more or less.
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?


Also, I was not aware you could put a subreport on a form. I hadnt ever
tried that. When I use the subform/report tool on a form all it allows
me to do is display a subform.
Sep 21 '06 #6

P: n/a
In article <mM******************************@adelphia.com>,
wd*******@adelphia.net says...
...assuming that these values are dynamic, I know of no "simple" way to do
this

...as always, when in need of doing something difficult, see www.lebans.com

...the SubClassFormatByCriteria sample mdb should give you what you need.

...hth

William Hindman

<Swans>; "What Swans?" <fz@barkingpumpkin.ooowrote in message
news:MP***********************@newsgroups.comcast. net...
In one of my tables, in addition to a text field that is a Description
field, there are two fields for color formatting the data in reports.
They are Longs and hold the foreground and background color values that
the Description in that record should be displayed in. For example, the
following records might exist...
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
There could be any number of records, most likely 10-15 but could be
more or less.
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?



Yes thats it. The data are printed and formatted (colored) in the main
report. This report is displayed on the form with the snapshot viewer
control. I would like to add to the form (as opposed to the bottom of
the report as a report or page footer) a legend of the color scheme for
the data displayed in the snapshot.
Sep 21 '06 #7

P: n/a
Swans wrote:
Bass - 255 - 16777215 (The word BASS displayed red on white)
Carp - 65535 - 0 (The word CAR displayed yellow on black)
Fish - 33023 - 8388672 (The word FISH displayed orange on purple)
I would like to be able to display a legend on one of my forms that
displays each Description formatted with its given fore/back color
combination. I have taken a stupid pill and can't figure out how to do
this. Can anyone help me here please?

HAve you tried the on format event in the detail section?

Assuming:

1) your field names are fdFish, fdFore, fdBack;

2) a report bound to a query of the fish and colour table; and

3) you have a text box called txtDisplay with a controlsource of fdFish.

Try the following in the detail on format event:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Me.txtDisplay.BackColor = Me.fdBack.Value
Me.txtDisplay.ForeColor = Me.fdFore.Value

End Sub

It works just fine in the quick test I just did.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Sep 21 '06 #8

P: n/a
Tim Marshall wrote:
HAve you tried the on format event in the detail section?
Disregard - my suggestion was for a report, not a form.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Sep 21 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.