473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to populate a Field based off of a selection made in a Combo Box?

Hey all! I have a Table named "Personnel". In the table I have 3 existing fields; "Cell Phone", "Home Phone" and "Work Phone". I want to create a combo box field in the table (or corresponding form) to select the individuals 'Primary Phone Number'. Then, in a report, I want to be able to have a column that will post the primary phone number based off of the selection made in the combo box.

Any advice would be greatly appreciated...
May 1 '13 #1
1 1200
nico5038
3,080 Expert 2GB
From a normalization point of view you would have to create a tblPhone with the fields:
PersonID
PhoneType
PhoneNumber
PrimaryYesNo
The PhoneType would hold "Cell", "Home" or "Work".
Now a query can select the rows with PrimaryYesNo = "Yes".
Or more advanced you could add a sequencenumber instead of the PrimaryYesNo field to show them in order or only #1.

Getting the idea ?

For getting a fieldvalue in the query you would need to dynamically create the query in VBA, or use a nested IIF() statement like:
Expand|Select|Wrap|Line Numbers
  1. select IIF(cmbTypeField="Cell",[Cell Phone],IIF(cmbTypeField="Home",[Home Phone],[Work Phone])) as PrimaryPhone, ....

Nic;o)
May 4 '13 #2

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

Similar topics

0
by: BK | last post by:
Hi, I have a problem. I need to auto populate fields based on a value entered in combo box. Initially, I put all the required fields in the combo box, and hide it (set to 0",0",0", ...), then...
0
by: ROO | last post by:
Hi Everyone, I have a database table that have 4 field( C1, C2, M1, M2) on my form i have two combo box ComboC and ComboM C1 C2 M1 M2 1 ...
5
by: Col | last post by:
I have a query with criteria that comes from a combo box on a form. I'd like to set the query up so the user can either limit the criteria to the selection in the combo box or the user can pull all...
6
by: Kazza | last post by:
Hi I'm using Access 2003 and I need to figure out how to display the record details based on a combo box selection. For example, when I select a company name in a combo box, how do I get the related...
3
by: Michelle Anderson | last post by:
I have an access form. In the form, it co ntains 3 fields : Type, hours, and Amount. Field "Type" is a combo box and it contains 2 values: Standard and Rush Field " Hours" is just a numeric...
2
by: kennygee | last post by:
I am trying to learn VB after many years programming in Access. I am trying to do something in VB that is simple in Access. How do I display record data on a form based on the selection made in a...
4
by: banderson | last post by:
Hello amazing vba writers, I am trying to make a combo box return a value based on a combo box selection. I have tried a number of the codes posted here and am still having problems. I think it is...
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
1
by: Kanapaha | last post by:
The table is tblOfficeLocations, which has 3 fields; Office_Code, Office_Name and State_Country. When I select the in cboLocation, I want the field to autopopulate with the State_Location. ...
1
by: Yasmeen Pannu | last post by:
HI, I am new to MS Access and stuck in a problem from few days. My Question: I have 3 combo box (Submitter, date from and date to) on my form and i want that when i select values from each of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.