Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Changing Font color in VB from one SubForm to the Main form in Access

Posted on 2013-01-16
2
Medium Priority
?
606 Views
Last Modified: 2013-01-16
I know the code for changing the font color in VB:

If [fieldvalue] < 0 then
[fieldvalue].forecolor = vbred
else
[fieldvalue].forecolor = (original color ) vb+color or rgb(87,171,83)
endif "green"


But can I change the font color from one subform to another?

Main form frmEditResources
Field I want to change to vbRed is First and last Name
SubForm: frmTotalAssigned_subform
Field is Balance (less than 0, name will change to Red.


Can this be done?
0
Comment
Question by:gracie1972
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 31

Accepted Solution

by:
Helen Feddema earned 2000 total points
ID: 38783686
First, it's not the field that has color, but the control, so make sure you give your controls the appropriate prefixes (txt, cbo, etc.) to avoid confusion.  To reference a control on another subform of the same main form, use this syntax:

Parent![subCategories].Form![txtCategoryName].BackColor = vbRed

Open in new window

0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 38783698
In many cases, you can do color changes based on a field value using Conditional Formatting.  Here is an example:

Conditional Formatting expression
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question