473,698 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing font color within column on form

Working on a report oriented application. One of the columns on a
form needs to be red, black or blue depending of the value in that
column. Can I write an expression to handle this or does anyone know
what code to use.
Nov 12 '05 #1
3 6227
You'll have to write code in the Detail On_Format Event

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If Me.txtType = 1 Then
Me.txtCompanyNa me.ForeColor = vbRed
ElseIf Me.txtType = 2 Then
Me.txtCompanyNa me.ForeColor = vbBlue
Else
Me.txtCompanyNa me.ForeColor = vbBlack
End If
End Sub
--

Danny J. Lesandrini
dl*********@hot mail.com
http://amazecreations.com
"jeffgeorge " <ki*******@aol. com> wrote in message
news:4f******** *************** ***@posting.goo gle.com...
Working on a report oriented application. One of the columns on a
form needs to be red, black or blue depending of the value in that
column. Can I write an expression to handle this or does anyone know
what code to use.

Nov 12 '05 #2
In the code below, is Detail_Format part of the declaration. SO it
would be COLUMN_NAME_DET AIL_FORMAT? Also, for the column, I'm trying
to have the column be formatted red if the field value in that column
is <= .25. How do I tie that into the code. What do txtCompanyName
and txtType refer to in my form. Use those terms or they refer to?
argh!

"Danny J. Lesandrini" <dl*********@ho tmail.com> wrote in message news:<br******* ******@ID-82595.news.uni-berlin.de>...
You'll have to write code in the Detail On_Format Event

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If Me.txtType = 1 Then
Me.txtCompanyNa me.ForeColor = vbRed
ElseIf Me.txtType = 2 Then
Me.txtCompanyNa me.ForeColor = vbBlue
Else
Me.txtCompanyNa me.ForeColor = vbBlack
End If
End Sub
--

Danny J. Lesandrini
dl*********@hot mail.com
http://amazecreations.com
"jeffgeorge " <ki*******@aol. com> wrote in message
news:4f******** *************** ***@posting.goo gle.com...
Working on a report oriented application. One of the columns on a
form needs to be red, black or blue depending of the value in that
column. Can I write an expression to handle this or does anyone know
what code to use.

Nov 12 '05 #3
I created a new report based on a table named tblStatus
It has two fields: StatusID and StatusDescripti on.
I named the text boxes txtStatusID and txtStatusDescri ption
and put this code in the Format event of the detail section:

Option Compare Database
Option Explicit

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
On Error Resume Next

Select Case Me.txtStatusID
Case 7
Me.txtStatusDes cription.ForeCo lor = vbRed
Case 8
Me.txtStatusDes cription.ForeCo lor = vbBlue
Case 9
Me.txtStatusDes cription.ForeCo lor = vbGreen
Case Else
Me.txtStatusDes cription.ForeCo lor = vbBlack
End Select

End Sub

If you want, I'll send you the sample, but that's really all there is to it.
--
Danny J. Lesandrini
dl*********@hot mail.com
http://amazecreations.com/datafast
"jeffgeorge " <ki*******@aol. com> wrote in message news:4f******** *************** ***@posting.goo gle.com...
In the code below, is Detail_Format part of the declaration. SO it
would be COLUMN_NAME_DET AIL_FORMAT? Also, for the column, I'm trying
to have the column be formatted red if the field value in that column
is <= .25. How do I tie that into the code. What do txtCompanyName
and txtType refer to in my form. Use those terms or they refer to?
argh!

"Danny J. Lesandrini" <dl*********@ho tmail.com> wrote in message news:<br******* ******@ID-82595.news.uni-berlin.de>...
You'll have to write code in the Detail On_Format Event

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
If Me.txtType = 1 Then
Me.txtCompanyNa me.ForeColor = vbRed
ElseIf Me.txtType = 2 Then
Me.txtCompanyNa me.ForeColor = vbBlue
Else
Me.txtCompanyNa me.ForeColor = vbBlack
End If
End Sub
--

Danny J. Lesandrini
dl*********@hot mail.com
http://amazecreations.com
"jeffgeorge " <ki*******@aol. com> wrote in message
news:4f******** *************** ***@posting.goo gle.com...
Working on a report oriented application. One of the columns on a
form needs to be red, black or blue depending of the value in that
column. Can I write an expression to handle this or does anyone know
what code to use.

Nov 12 '05 #4

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

Similar topics

2
63319
by: Mr.Baha | last post by:
Hello, I have a situation where I am appending text to a multi-line (rich)textbox in a C# form. Now depending on which event does the appendtext, i want to distinguish the lines in the textbox by having them written in different font colors. So my multi-line textbox will contain lines of various colored text. I tried setting the textboxe's ForeColor property, but quickly realized that the fore color will change every line within the...
4
3491
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a snippet from my .css file: *************************** body { margin:0; padding:0;
7
2965
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and already formatted as "Shopping" ---Bold "for" -----Regular Now I want to underline whole text by preserving old style i.e. Bold and
5
2666
by: Hymer | last post by:
Hello, I have a small two-column table with three rows. The first column has a logo and the second column has the name of the organization. The logo's in the first column are too high. That is, they don't align horizontally with the organization name. I need to lower the logo's within the column. However, I don't know how to manipulate one column at a time. Everything I
1
1864
by: Blasting Cap | last post by:
I am having trouble changing the font for a PushButton control in a datagrid button column. I have seen several posts refer to styles and simple changes to the HTML for font changes but most of those referred to a LinkButton type of control. But in cases where someone is using the PushButton there are no posted solutions. Whenever these changes are made to the PushButton control they do not make any requested changes. I have seen one...
1
1459
by: Markw | last post by:
Hi folks, I probably used the term 'report' incorrectly. Sorry for that in advance. The below code produces a 2 column web page that shows in the first column a picture and the 2nd column shows the person's name and address ad a few other things. What I would like is to change this into a 4 column report with no duplication. Could somebody help me with this, I'm sure it's simple enough but when your new to programming it all looks...
4
3341
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters the comments and clicks the save button then the date and the date will be stored in the mysql database. This is working fine. But my problem is when, after the user had made an entry the date in the calendar for which an entry has made should be...
1
2131
sujathaeeshan
by: sujathaeeshan | last post by:
Hi All, I am doing UI design(form design modifications) not programmatically. I am facing problem while appplying font to Data grid column . Here i am placing Data Grid within GroupBox. When i apply the Group box text font as Arial and bold this formatting applies to all controls which is placed inside the group box. But when i try to change the font as MsSanserif and Regular at ColumnheaderDefaultCell property of GridView,it will...
1
1678
sujathaeeshan
by: sujathaeeshan | last post by:
Hi All, I am doing UI design(form design modifications) not programmatically. I am facing problem while appplying font to Data grid column . Here i am placing Data Grid within GroupBox. When i apply the Group box text font as Arial and bold this formatting applies to all controls which is placed inside the group box. But when i try to change the font as MsSanserif and Regular at ColumnheaderDefaultCell property of GridView,it will...
0
9166
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
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 we have to send another system
3
2007
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.