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

List Box populate from Combo Box selection & save results.

FOE2272
20
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:
Main
List Architects

In the "Main" table I have the "Architect_Company" field
in the "List_Architects" table I have the following fields:
Arch_Company
Arch_contact
Arch_address
Arch_City
Arch_State
Arch_Zip
Arch_Country
Arch_Phone
Arch_Cell
Arch_Fax
Arch_Email

in the form I have a combo box which allows me to choose the "Arch_Company" from the "List_Architects" table and save the result in the main table in a "Arch_Company" field.

I want to display the other fields in the form based on the "Arch_Company" field, if Null to leave them blank and If additional data is typed in to save the data to the "List_Architects" table.

Or as much of this as can be done.
May 11 '07 #1
5 3885
MMcCarthy
14,534 Expert Mod 8TB
Have a look at this tutorial and come back with any questions.

Cascading Combo/List Boxes

Mary
May 12 '07 #2
FOE2272
20
That works fine to see the results, tried it the other day, but how do I get the results to save to specific fileds in a third table?

Where the chosen company from the "Company" combo box saves to a "Company" field and the chosen Employee from the "Employee Name" combo box saves to a "Employee" field of a 3rd "Results" table.
May 14 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
That works fine to see the results, tried it the other day, but how do I get the results to save to specific fileds in a third table?

Where the chosen company from the "Company" combo box saves to a "Company" field and the chosen Employee from the "Employee Name" combo box saves to a "Employee" field of a 3rd "Results" table.
Try something like this ...
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2.  
  3.    strSQL = "INSERT INTO Results (Company, Employee) " & _
  4.       " VALUES ('" & Me!Company & "', '" & Me!Employee & "')"
  5.    DoCmd.RunSQL strSQL
  6.  
Mary
May 15 '07 #4
FOE2272
20
Great, Where is the script below does it go? Obviously, I'm new at this.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Company_AfterUpdate()
  3.   With Me![Employee Name]
  4.     If IsNull(Me!Company) Then
  5.       .RowSource = ""
  6.     Else
  7.       .RowSource = "SELECT [EmpName] " & _
  8.                    "FROM TblEmployees " & _
  9.                    "WHERE [ID]=" & Me!Company
  10.     End If
  11.     Call .Requery
  12.   End With
  13. End Sub
May 15 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
It doesn't go in this code.

Put it behind a command button or in the on close and/or on change event of the form whichever is more suitable.
May 17 '07 #6

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

Similar topics

1
by: Adrian | last post by:
Hi I kind of new here, but how do i get a value from a combo box and populate a list box base on the selected value from a combo box? If possible can i get a sample coding Thank you. regards...
4
by: godber | last post by:
I need to populate text boxes for instance with employee information using their unique employee works number selected from a combo box. Can anyone help, I am told thru visual basic this can be...
1
by: Will | last post by:
I have a combo box on a form which is based on table tblMachine. On that combo box I have four columns visible MachineNumber, description, location and type. The bound column is the MachineNumber...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
4
by: scolivas | last post by:
I think this is a me thing. but can't remember how to do it. I have a form that I am using and would like for a txt box to automatically populate based on what is selected in a combo box. here...
5
by: RZ15 | last post by:
Hi, I've been through the tutorial for this and I've tried applying it to my database and it almost works but not quite. i have 2 combo boxes, cboPrgrp and cboSupplier. cboPrgrp is supposed to...
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
1
by: cluless | last post by:
Hey everybody, I have a database with one major form that has a few subforms and a listbox, and on the form there are buttons that link to other forms as well. Once the list box is clicked on, the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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
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...
1
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...

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.