Solved

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

Posted on 2013-01-16
2
587 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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 …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

739 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