473,409 Members | 2,063 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,409 software developers and data experts.

Populate two fields with one combo box

Michael Adams
I have been working on this form for quite some time with alot of help from this forum and its users. Everyone has been very helpful and there are great solutions from everyone. I also posted a useful pice of code for querying a date range along with three different requirements. You can find that solution here:
http://bytes.com/topic/access/answer...-query-records

Now for my question: I would like to be able to write to my form two separte fields. The first data is in the combo box being selected by the user, the second would be according to the first, ie. MWB(1st) (combobox) Mountain West Bank (2nd). The data would populate the fields [branch] and [bank] respectfuly.


Looks as though the command I am looking to execute is an insert/inserttext one.

Thanks in advance
Jul 26 '10 #1

✓ answered by jimatqsi

Perhaps what you want is to make the combo box query have two columns. The first column will hold the MWB value, the second column will have the "Mountain West Bank" value. The combo box will be bound to field [branch].

Separately, you will need a textbox txtBankName bound to [bank].

In the AfterUpdate event of the combo box, add this code:
Expand|Select|Wrap|Line Numbers
  1. me!txtBankName = me!comboboxname.Column(1)
.

That will plug the Bank name into the text box whenever a selection is made in the combobox.

Jim

3 11890
jimatqsi
1,271 Expert 1GB
Perhaps what you want is to make the combo box query have two columns. The first column will hold the MWB value, the second column will have the "Mountain West Bank" value. The combo box will be bound to field [branch].

Separately, you will need a textbox txtBankName bound to [bank].

In the AfterUpdate event of the combo box, add this code:
Expand|Select|Wrap|Line Numbers
  1. me!txtBankName = me!comboboxname.Column(1)
.

That will plug the Bank name into the text box whenever a selection is made in the combobox.

Jim
Jul 26 '10 #2
I might have explained it wrong, either that or I am not understanding the answer Jim. I have a form that populates a table and in this form I have a combo box with branch data(we have over 100 branches; however, we only have 11 banks) so, in other words there are 100 different rows to one field in a table and only 11 rows in another table.

What I would like to do is when the user selects the branch the work was done at the form will populate both fields in a master table. How do I code that to happen in vba on the back end?
Jul 26 '10 #3
I was going down the wrong path, ie. trying to use a wildcard in a select case statement. Just FYI Wildcards are not recognized in a case statement!

This is what my final code looks like thanks to Jim.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Bank_Combo_AfterUpdate()
  2. Me.Bank.Value = Me.Bank_Combo.Column(1)
  3. End Sub
Jul 27 '10 #4

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

Similar topics

10
by: Lukelrc | last post by:
Hi, I have an array - ListOfFiles - that i want use to populate an combo. I've attempted to do it like this <select name="txtAvailable" rows="4" id="txtAvailable"> <Script Language =...
0
by: Joyce | last post by:
The XML Schema design problem to solve is as follows: We have 2 combo boxes to populate from schema data, let's say: 1. States 2. Cities (and this one gets populated depending on the choice of...
1
by: jdph40 | last post by:
On my form I have a tab control that contains 12 subforms. The child/master field that links the main form to each subform is IncidentNo. Each subform is used to record a corrective action that...
2
by: Dave McKie | last post by:
Hi all I am trying to Populate a combo box from a selection in an adjacent Listview. The Listview lists as a string the field names of 4 different fields in tblFile. So far I can populate the...
8
by: zeilak | last post by:
I am running Windows XP, Access 2002. I want to know the VB code for the following: I want to type in the ID # (it's the primary key and is auto-numbering) and then have the access form...
2
by: JReneau35 | last post by:
I am using a form that should have a combo that when I select a certain item from the list it populates the information from the table to the necessary fields.
5
FOE2272
by: FOE2272 | last post by:
I have tried every option that I can think of and most of them on this forum. The closest that I got was to bring up the field but it changed the other records based on what was chosen in one...
3
MattFitzgerald
by: MattFitzgerald | last post by:
My Forms & Tables:- Main form is Frm_LE_List (contains Customer Details) Stored in Tbl_LE_List Which contains subform Frm_VOL_References (Contains Orders known as VOL's) Stored in...
1
by: cluless | last post by:
Hey everyone, I have two combo boxes in a form, and I'm trying to populate one based on the selection of another. I tried using someting like !! in the criteria of the query for the row source of...
21
AccessIdiot
by: AccessIdiot | last post by:
I have one big fat table with goose nesting data. Things like nest location (name of island in a river), nest type (ground/platform), number of eggs, number of eggs hatched, type of predation, etc. ...
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
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,...
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...
0
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...

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.