Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

862 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now