Solved

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

Posted on 2013-01-16
2
560 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
  • 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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 …

810 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