473,933 Members | 10,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Conditional formatting, changing a memo contingent on a combo

26 New Member
Hi all
I’m trying to figure this out. But help is needed. I have a combo box called fcmFLAG with 5 options (problem, hold off, call, withdrew and ineligible). What I would like to do is have the background in a memo box (fcmFcom) change to a different color for each option. I don’t think this can be done with Conditional formatting because it’s more then 3. The problem is that I just started getting into VBA but I have been using Access for over a year. So any help with coding this would be of great help.
Oct 23 '07 #1
6 1661
missinglinq
3,532 Recognized Expert Specialist
To change the memo field's back color

Expand|Select|Wrap|Line Numbers
  1. Private Sub fcmFLAG_AfterUpdate()
  2.   Select Case fcmFLAG
  3.     Case "Problem"
  4.       fcmFcom.BackColor = vbRed
  5.     Case "Call"
  6.       fcmFcom.BackColor = vbGreen
  7.     Case "Hold Off"
  8.       fcmFcom.BackColor = vbBlue
  9.     Case "Withdrawn"
  10.       fcmFcom.BackColor = vbYellow
  11.     Case "Ineligible"
  12.       fcmFcom.BackColor = vbCyan
  13.     Case Else
  14.       fcmFcom.BackColor = vbWhite
  15.    End Select
  16. End Sub
  17.  
So that the color formatting is maintained moving record to record

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.   Select Case fcmFLAG
  3.     Case "Problem"
  4.       fcmFcom.BackColor = vbRed
  5.     Case "Call"
  6.       fcmFcom.BackColor = vbGreen
  7.     Case "Hold Off"
  8.       fcmFcom.BackColor = vbBlue
  9.     Case "Withdrawn"
  10.       fcmFcom.BackColor = vbYellow
  11.     Case "Ineligible"
  12.       fcmFcom.BackColor = vbCyan
  13.     Case Else
  14.       fcmFcom.BackColor = vbWhite
  15.    End Select
  16. End Sub
  17.  
Of course, the combo box has to have it's value bound to a field in the table for the formatting to hold.

Welcome to TheScripts!

Linq ;0)>
Oct 24 '07 #2
NeoPa
32,584 Recognized Expert Moderator MVP
Don't listen to him. He's no good.
Expand|Select|Wrap|Line Numbers
  1. Try Private Sub fcmFLAG_AfterUpdate()
  2.   Call setColour()
  3. End Sub
  4.  
  5. Private Sub Form_Current()
  6.   Call setColour()
  7. End Sub
  8.  
  9. Private Sub SetColour()
  10.   Select Case fcmFLAG
  11.     Case "Problem"
  12.       fcmFcom.BackColor = vbRed
  13.     Case "Call"
  14.       fcmFcom.BackColor = vbGreen
  15.     Case "Hold Off"
  16.       fcmFcom.BackColor = vbBlue
  17.     Case "Withdrawn"
  18.       fcmFcom.BackColor = vbYellow
  19.     Case "Ineligible"
  20.       fcmFcom.BackColor = vbCyan
  21.     Case Else
  22.       fcmFcom.BackColor = vbWhite
  23.    End Select
  24. End Sub
Of course I nicked all the actual code from Linq :D
Oct 24 '07 #3
BUmed
26 New Member
You guys rock, this worked like a charm. On a side note, since I'm just getting started with VBA can you recommend any good sources to study (websites, books tutorials).
Thanks
Steve
Oct 24 '07 #4
NeoPa
32,584 Recognized Expert Moderator MVP
It's all Linq's work really of course. I just added the format of how to reuse code in multiple events so that it's :
  1. Clearly the same.
  2. Maintainable in a single place.
I can give you a link to an index of our Articles section (Full List of Articles and Code in this Section). This may not have what you're looking for but I'm afraid I don't have any links to learning tutorials.
Oct 25 '07 #5
missinglinq
3,532 Recognized Expert Specialist
Fess up, NeoPa! You're just trying to sow confusion in a newbie so they'll have to come back!

Linq ;0)>
Oct 25 '07 #6
NeoPa
32,584 Recognized Expert Moderator MVP
IT'S ALL TRUE!! <crying with shame>
I confess :(
Oct 26 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5377
by: Andante.in.Blue | last post by:
Hello everyone! I'm building a form in Access 97 and I want to to show a special icon if the record has been marked as deleted. Obviously, I don't want the icon to show if the record was not marked as deleted. I understand the conditional formatting is available in Access 2000 for this purpose, but it is not in 97. Is there a way to emulate this effect through code? Thanks for any input on this matter. Alan
2
357
by: jeffgeorge | last post by:
Trying to add 3 colors to 6 combinations of text possibilities. If this makes sense, the possibilities are: A D (one color for the combo beginning with A) A E B D (One color for the combo beginning with B) B E C D (One color for the combo beginning with C)
4
3158
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the background colour. In A2000 it works great, but in A2003 the background doesn't always change and when it does it only changes when the record looses the focus. Any way around this? Is it a bug? Or have they "improved" it?
2
5846
by: Megan | last post by:
Can you write conditional VBA code that affects only one or two records on a continuous subform? I have a form with a subform on it. The parent/ child field that links the forms is CaseID. The main form has personal info on it. The subform deals with each case's Issues, Decisions, and Notices. Issues, Decisions, and Notices are all combo boxes. Not all Issues have Notices. Issues 25-50 have Notices. Issues 1-24 and 51-100 don't have...
4
2726
by: deko | last post by:
I've heard it's best not to have any formatting specified for Table fields (except perhaps Currency), and instead set the formatting in the Form or Report. But what about Yes/No fields? When I create a Yes/No field in a Table the default format is "Yes/No". If I clear or change the Format property in the General Tab (and keep the default "Checkbox" in the Lookup tab), the field still looks the same when I open the table in Datasheet...
12
2382
by: dmieluk | last post by:
Problem: When moving between records, I need to control which combo/text boxes are displayed on the current form, dependent upon data in the current record. More: I building my first access database.
8
8538
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works perfectly. However, I have code that runs under the ON CLICK event. The code changes the focus to other controls, which means the conditional formatting is no longer displayed. This part makes sense to me. Here's what doesn't make sense. The last...
4
8994
by: slinky | last post by:
Thanks in advance... I have a continuous style form with a field for each record called "STATUS". I simply want to have the form load and if the value of the textbox is "Inactive" I want the textbox background to display yellow, else I want it to be just white. Here's my code... but it is not working Private Sub Form_Load() If Me!STATUS = "Inactive" Then Me!STATUS.BackColor = RGB(255, 255, 0) Else
3
7066
by: aeon | last post by:
Working in Access 2007 on XP I have a combo box that I'm using in a form to select the WorkCategory assigned to a particular person in my database. WorkCategory is a lookup field in a table called Person. It is looking up the category type from another table called WorkCategory which is a list of 3 types of categories (offshore, onshore, visitor). In the form, when I use the drop-down menu of the combo box to select one of the work...
0
10122
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9954
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
11260
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9843
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7365
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6059
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6267
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4433
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.