473,466 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Change the colour of a records font, based on value in field Multiple Item Forms

112 New Member
I am trying to change the font colour of certain records in a Multiple Item Form based on what value is in a Combo-box. The code below works for a single record view form but not the multi. It will change all the records displayed to the colour of which ever record I am currently on. Is there a way of making it work so that only the records with the value I have set appear with the colour I have set?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. '0 is for black
  3.     '255 is for red
  4.     '2337696 is dark yellow OnLoan
  5.  
  6. If Forms!frmFormlist![CurrentLocationSite].Value = "Deaccessioned" Then
  7.         ChangeFontColor ("255")
  8.     Else
  9.         ChangeFontColor ("0")
  10.     End If
  11.  
  12.     If Forms!frmFormlist![CurrentLocationSite].Value = "On Loan" Then
  13.         ChangeFontColor ("2337696")
  14.  
  15.     End If
  16.  End Sub
Expand|Select|Wrap|Line Numbers
  1. Public Sub ChangeFontColor(color As String)
  2.     Forms!frmFormlist![txtAccNum].ForeColor = color
  3.     Forms!frmFormlist![ObjectName].ForeColor = color
  4.     Forms!frmFormlist![ObjectType].ForeColor = color
  5.     Forms!frmFormlist![CurrentLocationSite].ForeColor = color
  6.     Forms!frmFormlist![PermanentLocationSite].ForeColor = color
  7.     Forms!frmFormlist![Subject/Image].ForeColor = color
  8. End Sub
Mar 17 '11 #1
5 5653
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Nope.

But you can use conditional formating to colour a single field on your continuos form. (or apply conditional formatting to all fields). However conditional formattign seems to be a bit sluggish when I have used it.
Mar 17 '11 #2
NeoPa
32,556 Recognized Expert Moderator MVP
Smiley's absolutely right about that. See Why Values in Unbound Form Controls Don't Persist for a fuller explanation.
Mar 20 '11 #3
Redbeard
112 New Member
Thanks guys, has you have saved me time trying to figure how to do something that is not possible. Also Thanks NeoPa for the artical... I now understand why.
Mar 21 '11 #4
NeoPa
32,556 Recognized Expert Moderator MVP
Very pleased to hear it Redbeard :-)

Knowing to/not to do something is one thing. Understanding why is so much better.
Mar 21 '11 #5
mshmyob
904 Recognized Expert Contributor
What version of Access are you using? If using AC2007 above you may find this helpful.http://bytes.com/topic/access/insigh...imited-colours

cheers,
Mar 21 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: BKM | last post by:
Is there a way that I can change the default font in VB6 so I don't have to constantly change the font of each new control that I add to my project?
1
by: amber | last post by:
Hi there, I'd like to change the colour of my tabs. I can change my background colour of my tab control, but the actual tabs, with the text on them don't change colour. Am I missing something?...
0
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of...
2
by: James X. Li | last post by:
Is there a way to implement multiple login forms for ASP.NET applications? With our application we want to implement simple login form for normal resources (downloadable files), but more rigorous...
4
by: ACaunter | last post by:
Hi there, I was wondering if there was a way to change the font color of the text in the title bar... by default the title bar is that dark blue faiding into light blue and it has white text......
5
by: David | last post by:
I want to get the Sel_142's multiple item's value, and put them in an array. if ( !Sel_142.Multiple ) vo.CA142 = Sel_142.Items.Value; else { Sel_142.Items..... }
0
by: riteshraha | last post by:
I cant retrieve selected item from checkboxlist in asp.net project. when i submit multiple item from checkboxlist it works fine. but when i am trying to edit this items then checkboxlist does not...
1
by: johnniewalkeresp | last post by:
Hi, I'm having trouble with the following: I have a portfolio table with a field called "Bid/Offer" which is filled in by selecting Bid or Offer from a combo box. Now I need to create a query...
7
by: Nasher | last post by:
i have a combo box (combo box 1) in a form header that users use to selct item numbers from. I also have a combo box (combo box 2) that users use to select a priority number (1,2,3) for that item....
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
1
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...
0
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.