473,387 Members | 1,464 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,387 software developers and data experts.

Combo Box populating 2 text boxes automatically

I have a tblSupplierInformation which consist of SupplierID, ContactName, PhoneNumber among other name fields.

I’m creating a combo box from the tblSupplierInformation to a form “Purchase Order Entry”. I want to create 2 text box to be populated with ContactName, PhoneNumber from that table when a supplier name is selected. How do I do that?

Access2000
Vista

Thanks,
John
Mar 4 '08 #1
5 2010
Stewart Ross
2,545 Expert Mod 2GB
I have a tblSupplierInformation which consist of SupplierID, ContactName, PhoneNumber among other name fields.

I’m creating a combo box from the tblSupplierInformation to a form “Purchase Order Entry”. I want to create 2 text box to be populated with ContactName, PhoneNumber from that table when a supplier name is selected. How do I do that?

Access2000
Vista

Thanks,
John
Hi John. Include in your combo's recordsource query the supplier ID, the supplier name, the contact name, and contact phone number. Your combo is presumably bound to the supplier ID field in your purchase order table.

With a small amount of VBA code in the After Update event of your combo control you can set the values of the contact name and phone number controls when the user makes a selection from the list, like this:
Expand|Select|Wrap|Line Numbers
  1. Me![ContactName] = Me![name of your combo].Column(2)
  2. Me![PhoneNumber] = Me![name of your combo].Column(3)
Combo columns are numbered from 0. The first column is column(0), the second column (1) and so on. If you order the combo columns differently, or alter the number of fields you are displaying, you will need to change the column references accordingly.

Hope this helps.

-Stewart
Mar 5 '08 #2
I am trying to do the same type of thing. Do I need to change Me! to a form name or query name?
Mar 5 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
I am trying to do the same type of thing. Do I need to change Me! to a form name or query name?
Hi. The 'Me!' part is Access shorthand in a form or report's code module for referring to the associated form or report without explicitly saying so. If you need to refer to controls on a different form or report, either to copy from them or to them, then you need to be explicit about the reference using one of several ways to refer to controls, such as
Expand|Select|Wrap|Line Numbers
  1. forms!formname!controlname 
  2. forms("formname").controls("controlname") 
  3.  
etc. Of course, you will need to make sure that the form you are referring to is open at the time.

The syntax for referring to a control on a subform is different:
Expand|Select|Wrap|Line Numbers
  1. me!subformname.form!controlname
  2. forms!formname!subformname.form!controlname 
-Stewart
Mar 5 '08 #4
Thanks. I got it to work.
Mar 5 '08 #5
Mine too!!! THANK YOU VERY MUCH.

Thanks. I got it to work.
Mar 6 '08 #6

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

Similar topics

1
by: Daniel Hill | last post by:
OK, I have very, VERY basic background knowledge of VB6 and have now upgraded to VB.NET and now I'm struggling to bring up the forms I want. What I am looking to do is to have a click a command...
0
by: Jim | last post by:
Hi, there, I am a beginner on Access. I have been taking so long time to try to figure out his, but so far, no clues. I want to select 2 combo boxes and Access will automatically fill in...
2
by: visionstate | last post by:
Hi there, I am working on a form that uses 3 text boxes and 3 combo boxes. When any data is entered into any of these, I click a command button and this requeries a sub query in the form and...
6
by: zuchowra | last post by:
Hi everyone. I need help. I have a combo box in my form that i want to populate multiple text boxes after you select your selection in the combo box. Here is my set up. The Fields that need to be...
2
by: Dave | last post by:
I have 3 tables of information feeding into 4 combo boxes on my main form (DR Form). I have as many list boxes (acting as text boxes) as there are fields in each one of the 3 tables. Once...
2
by: SHAWTY721 | last post by:
I have a form that contains two combo boxes that are related to each other. I need to find a way to populate my text box based on the criteria of the two combo boxes so the appropriate number...
1
by: blip | last post by:
I’m not sure I’ve posted in the correct place however…. I’ve been trying to get this to work for some time now. I have created 10 combo boxes on an Excel form. The first one contains a name,...
0
by: Dawnyy | last post by:
I have a form which is bound to a dataset. I am filling the forms dataset on Form_Load event. On my form I have combo boxes which I am setting by running a stored procedure to return a datatable,...
11
by: jgoodnight | last post by:
Hi, I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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,...
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.