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

Combo box SELECT both form and subform

I have 2 tables with 1 to many relationship. First Table which is hosted on the main form of my database has records with products of some type and the second table which is in datasheet view in the subform has records with "pieces" of each product.
I want to make a combo box in the Main Form which will list and select the following 2 fields in a 2-column list. First column will have the ID field from the second table which is in the subform and in the second column there will be the field named Code from the first table which is in the main form. Ofcourse by typing in the Combo box the [ID] number of the 2nd table should put in the second column the [code] field from the record that is related with the ID in first column.
What After Update event should I type to do that?
For a single form i had the following.
[code]SELECT [Table1].ID, [Table1].[code] FROM Table1 ORDER BY [Table1].
Expand|Select|Wrap|Line Numbers
  1. ;
Dec 16 '11 #1
3 1585
TheSmileyCoder
2,322 Expert Mod 2GB
It is difficult to judge what level of expertise you have in access. Im hard pressed to understand why you need this? Why do you need the ability to select a field [code] which must allready be available in your form?

If you could try to explain in non-technical details what it is you need to accomplish?

Edit: Please also supply info on which version of access you are working in, and whether you believe yourself to be experience in access and VBA.
Dec 16 '11 #2
Im novice in Access but writting code in Java. I also know GW-Basic and cobol as non object-oriented languages. To better explain. I have a warehouse with textiles. Main form has a table with textile code. But each textile exists on several rolls(second table) that are on the subform each one with unique piece number which ofcourse is the second tables primary key. I need to input the roll number on a combo box on the main form and after update display the record of the textile to which that roll number is connected to. To have my event code work I need the ID of the second table on one column and the ID of the first table on the other column.
Dec 16 '11 #3
NeoPa
32,556 Expert Mod 16PB
It seems that you may not appreciate that sub-forms can be connected to their main forms automatically by setting the Link Child Fields and Link Master Fields properties in the Sub-Form control. With that sorted, I would guess you really just need a way to allow you to filter on the main product (See Example Filtering on a Form). All the "Pieces" will then be filtered automatically to show only those "Pieces" which match the selected product.
Dec 16 '11 #4

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

Similar topics

0
by: Josh C. | last post by:
Hello everyone. I'm a bit of an Access newbie, so please bear with me. Please go to http://www.dumoti.com/access/ to view the database - 536kb. I'll go straight into examples: In the form...
4
by: Don Seckler | last post by:
I am building an application to track the distribution and returns of copies of magazines. Copies of a magazine that are unsold are returned by the retailer to the wholesaler. They are...
3
by: Simone | last post by:
Hi All, I have a Find Record button setup in most of my forms in order to find a specific customer's details. I have just noticed today though that this search will only find the customer if it...
5
by: ego | last post by:
Hi all , I had created the following Form/SubForm structure : MainForm SubForm A (SubForm of MainForm) SubForm B (SubForm of SubForm A) SubForm C (SubForm of SubForm B) SubForm D ...
9
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from different lists depending on which option is...
10
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
3
by: ghat12 | last post by:
Hi, I have created a form containing 5 textfields/combo boxes and a command button to conduct searches for matching records. My results are currently displayed as a separate datasheet which is...
5
by: Ron | last post by:
Hi All, I've got a form called frmCust that has a subform on it called sfrmBalance. sfrmBalance's control source is a query called qryTrans4CustBal. sfrmBalance has one field on it called...
4
by: virtualgreek | last post by:
Dear All, First of all I would like to take the time to thank you all for your efforts and time spent at this wonderful forum. I have found it very helpful with numerous examples available for...
1
by: troy_lee | last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with another table (Table B). I am having trouble with a form/subform setup to view the 1:M records. On the parent form, there is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.