473,670 Members | 2,389 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 5313
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
10222
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 data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
1
1675
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" field with code2 where it = code1 So in the end, tbl_Codes contain codes based on the mapping rules in tbl_Map.
8
18347
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 ". The values in the dropdown are loaded in the correct order, but the initial value is not the first row of the dropdown as I expected. The field "CategoryName" is not the primary key for the table -- the PK is
3
2817
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 DeptId is equal to 1 then fromCargoEntry should open on top of the current form for data entry. Can someone help me with the correct phrasing? My main form is frmNewJobs. Thanks. Karen
0
914
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 issue I had with a bound combo box, whereby nulls were populated with values (A known bug with MS). If my first record has a value other than period, when the user first loads the form it is displayed as a period, & subsequently my dataset is...
1
3255
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 returnData() As Object Do While myReader.Read()
0
1093
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 source shows the detail of customer as selected in combo box , any idea how can I do so ? Best Regards, Luqman
2
13137
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" cellpadding="5" cellspacing="2" width="95%">
3
4581
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 out the value of FileNameToOpen of that same record, in order to open the particular file. How can I achieve this? Thanks in advance, john
4
10805
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 $5500
0
8469
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
8386
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,...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8592
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,...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5684
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
4391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2800
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 we have to send another system
2
1794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.