473,386 Members | 1,743 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.

Fill field based on another field??

135 100+
Ok.
I have a form with a field for a sampler's name, number, and email address. The sampler's name is selected from a combo box that references a table with name, number, and email. I want to be able select the name in the combo box and have the fields for the phone number and email address fill with the selected sampler's info. I have tried setting the control source of another combo box (for the email address) to the samplers name combo box. This does show the email address, but when I try to use that for my email it comes in as the Sampler's Name (primary ID) instead of the address. HELP?
Nov 15 '08 #1
2 4194
Stewart Ross
2,545 Expert Mod 2GB
Hi. The unseen columns of the combo list are available using the Column property of the combo box control. Columns are numbered starting from 0. Column 0 is normally the combo's bound value and is the one referred to by default when you reference the combo directly as you have found out.

All you need to do is work out which column you need and use the Column property to get the value. If it was the second column you would refer to it like this:

[yourcomboname].Column(1)

If you are setting the values of textboxes bound to underlying fields in your table such as an e-mail address, you can set their values using VBA code in the After Update event of the combo to reflect the change of selection as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub yourcomboname_afterupdate()
  2.    me![name of emailtextbox] = me![yourcomboname].column(1)
  3.    me![name of your number textbox] = me![yourcomboname].column(2)
  4. End Sub
You would of course need to replace the names and column positions with the right ones for your own application.

-Stewart
Nov 15 '08 #2
MyWaterloo
135 100+
Hi. The unseen columns of the combo list are available using the Column property of the combo box control. Columns are numbered starting from 0. Column 0 is normally the combo's bound value and is the one referred to by default when you reference the combo directly as you have found out.

All you need to do is work out which column you need and use the Column property to get the value. If it was the second column you would refer to it like this:

[yourcomboname].Column(1)

If you are setting the values of textboxes bound to underlying fields in your table such as an e-mail address, you can set their values using VBA code in the After Update event of the combo to reflect the change of selection as follows:

Expand|Select|Wrap|Line Numbers
  1. Private Sub yourcomboname_afterupdate()
  2.    me![name of emailtextbox] = me![yourcomboname].column(1)
  3.    me![name of your number textbox] = me![yourcomboname].column(2)
  4. End Sub
You would of course need to replace the names and column positions with the right ones for your own application.

-Stewart
Thanks Stewart. Seems to be just what I'm looking for.
Nov 16 '08 #3

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

Similar topics

2
by: John Scott | last post by:
Hi there, I have a PDF that has editable form fileds. I want to be able dynamically fill in those form fields based on values I provide to the PDF. Right now, I can create an instance of the...
1
by: ogilby1 | last post by:
Using an immediate if to fill a field on a form based on the value of another field. During data entry on the form this methodology works well. When looking at the results in the datasheet view or...
3
by: euphorica | last post by:
I am making an inventory database. I have a field InventoryNumber where I put a specific code. The code always starts with a particular letter. I would like to fill in another field with...
0
by: tshad | last post by:
MSN has a toolbar that has a Form Fill function that will try to fill form fields on forms when they come up. The problem is that it causes problems with some forms and functions. I found this...
10
by: RoadRunner | last post by:
Hi, I have a employee vacation database that has a vacation table that has the employee name, pay week and date of vacation. I have another lookup table with pay week code and date range for the...
1
by: Kev | last post by:
Hello I have a form (RosterForm) based on a table - RosterRange RosterRange has 4 fields: RosterRangeID Autonumber RosterStartDate Date RosterEndDate Date (probably...
4
by: khengi | last post by:
Hi, I'm a newbie, so I guess this is a question that expresses my total ignorance, but never the less: I have an old table into which I want to add a column that will automatically update based...
1
by: boyd | last post by:
I am sure this is easy but I can't seem to do it. I have a table, PartNumberTableCond, that has two column, PartNumber and PartDescription. I have a Form, Input, that I want to be able to put in a...
1
by: peasedm | last post by:
Okay this one has me stumped. I have a table called Review_Statements with the following columns: statementid type statement1 statement2 statement3 I have a form called SR_Review with an...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.