473,513 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to change color of a combo box based on value of a field in a table?

5 New Member
The form has a combo box with a list of names. I want the background color to change if the name is a female. In a table I have a field called "M/F" with "Male" and "Female" as values. Any suggestions?
Feb 3 '11 #1
1 5286
pod
298 Contributor
try :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combobox1_Change()
  2. If Combobox1.Value = "F" Then
  3.     Combobox1.BackColor = 16744703
  4. Else
  5.     Combobox1.BackColor = 16776960
  6. End If
  7. End Sub
  8.  
Feb 3 '11 #2

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

Similar topics

25
10170
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
1
1668
by: Juzam55 | last post by:
I have a table of mappings of various codes, tbl_Map with fields mapID, code1 and code2 I need to write and Update command that for each row in tbl_Map updates another table's, tbl_Codes, "code"...
8
18308
by: Lyn | last post by:
Hi, Can anyone tell me how the initial value displayed in Combo Box is determined when a form is opened? I am loading the dropdown from one field ("CategoryName") of a table, with "ORDER BY ". ...
3
2804
by: Rosy | last post by:
Hello all. I think my request is a simple one; however, I am unable to figure it out by myself. I need a form (frmCargoEntry) to open whenever the cargo dept is chosen on another field. So when...
0
910
by: James | last post by:
I have a bound combo using a lookup table which is behaving as expected with the exception of the first record. In the list of rows for my combo, the first is '.'. This is because of another...
1
3250
by: Sam | last post by:
Hi, I don't know how to specify the display and value field for a combobox when using AddRange to fill the combo. Here is what I have so far: -A function to build an array of object : Dim...
0
1090
by: Luqman | last post by:
My combobox is bound to sqldatasource, what I want is, when I change the combobox selected value, the sql datasource should be positioned to that value, so that all textboxes bound to that sql data...
2
13133
by: nitindutt2005 | last post by:
Hi I have a html file as below. ==================================================================== <html> <head> <td style="background-color:rgb(170, 157, 244);"> <table border="0"...
3
4578
by: John | last post by:
I have a 2 field table. Field 1 is Category (unique) and field 2 is FilenameToOpen. In code I would like to search for a value in the field Category. When the record is found I would like to pull...
4
10788
by: billa856 | last post by:
Hi, I want to know how can we set the value of Textbox = value of field in table when we select a value form combobx. example i have a table customer CID CNAME CSALARY 1 Billa ...
0
7260
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,...
0
7160
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...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7525
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...
0
4746
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...
0
3233
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...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
799
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.