472,801 Members | 1,152 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,801 software developers and data experts.

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

112 100+
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 5627
TheSmileyCoder
2,322 Expert Mod 2GB
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,534 Expert Mod 16PB
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 100+
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,534 Expert Mod 16PB
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 Expert 512MB
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....
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...

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.