473,699 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate two fields with one combo box

Michael Adams
55 New Member
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
3 11921
jimatqsi
1,276 Recognized Expert Top Contributor
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
Michael Adams
55 New Member
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
Michael Adams
55 New Member
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
1866
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 = "vbscript" Runat = "Server"> For i = 0 to Count -1 Response.Write"<OPTION>" & ListOfFiles(i) & "</OPTION>"
0
1670
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 the state) The event management is no problem, the question is, how do we build our XML Schema (that's going to contain the data for both states and
1
3612
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 needs to be taken when an incident occurs. The user must enter the corrective action in a text box, then choose from a combo box the name of the employee who is assigned the task of completing the corrective action, and in another text box,...
2
2904
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 combo box with the correct number of records(only 4 in the test database) but the data is the actual string being passed which is actually the right field....just not the data in the field. Here is my code so far that fills the combo box with the...
8
2551
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 autopopulate three fields for that ID # record. (The three fields are called pu, am, and qu). Pu should populate with a vaule of 1. Am should populate with a value of 38. Qu should populate with a value of 1. Can you please send me the code? Thank you!
2
1396
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
3914
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 record. Details: DB with one main table and several list (reference) tables. I want to populate several list boxes on one form based on a choice from a combo box. Example: Tables:
3
2735
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 Tbl_VOL_References This subform has subform Frm_Order_Lines (Contains line items for orders) Stored in Tbl_Order_Lines I also have a table Tbl_Rate_Card_Lookup (This contains information used to populate Tbl_Order_lines Relationships:- Tbl_LE_List is related...
1
3548
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 the secondary combo box, but it doesn't seem to be working. What do I do? Thanks!
21
2627
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. I have some canned queries that I need to report: total number of eggs, number of eggs by island, number of eggs by type, number of nests, number of nests by island, number of nests by type, etc. So there are a few basic questions (total # nests,...
0
8620
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8920
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
8887
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7755
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
6536
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
5877
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
4378
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...
0
4633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2351
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.