By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,599 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,599 IT Pros & Developers. It's quick & easy.

Combo box SELECT both form and subform

P: 2
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
Share this Question
Share on Google+
3 Replies

Expert Mod 100+
P: 2,321
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

P: 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

Expert Mod 15k+
P: 31,709
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

Post your reply

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