473,657 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fill field based on another field??

135 New Member
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 4247
Stewart Ross
2,545 Recognized Expert Moderator Specialist
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 New Member
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
6619
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 object, open the PDF document, but can't get a handle on the JavaScript portion of the document in order to change any of the form field values. Here is a snippet of my code so far: Type AcroApp = Type.GetTypeFromCLSID(new...
1
6584
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 the underlying table this immediate if field contains the default value that was set when originally setting up the table and the form. =IIf(=10100100, "CR", "DB") => this works well in the flow of the form but does not actually populate the...
3
1832
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 specific information based on what that letter is. Can somebody show me how to do this? Thanks in advance.
0
1266
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 out this weekend. If you have your address set up in your Form Fill function, any form that has these fields (name, address, city, phone etc) will automatically be filled in. MSN has a toolbar you can download for IE, that is something I am...
10
2240
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 week. The user would like to type in a date in the Date of Vacation field and have the Pay Week field automatically fill in. My dlookup code is not working. Here is example of what the tables look like: Employee: Name Pay Week Date of...
1
2186
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 unnecessary) Ward Text I have 2 unbound combo boxes looking up values - cmbDepartment and
4
3399
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 on one of the existing columns. The existing column contains a text string, and the new one should contain a part of it, using text trancation functions (such as left, mid, etc.. with which I'm familiar). Is This possible? Should this be done...
1
1968
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 number from PartNumberTableCond, using a combo box, cboPartNumber, or just key in a new number. Then I want my PartDescription field to fill-in automatically if the number in cboPartNumbers is an existing part number. I think I need to put some...
1
3636
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 unbound combo box control
0
8394
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
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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
7327
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...
1
6164
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
5632
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
4152
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...
1
2726
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
1955
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.