Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Subforms to add a full record from a table to another table

Status
Not open for further replies.

mswarner

IS-IT--Management
May 5, 2000
9
US
I'm trying to set up Bills of Materials for a project I'm doing.  I have an raw material item master table.  For each product, I want to be able to type in a raw material item number in a subform and have it bring up the whole line for that record in the item master table.  It does not necessarily have to save the whole line in the BOMs table, I just want it to display the info on the screen so the user doesn't just have a screen of item numbers.
 
Let me try this again.&nbsp;&nbsp;What you first need to do is create an identical raw material item field on the table of your subform.&nbsp;&nbsp;Now go to your subform in design view and add that field to your form (Don't worry, we will make it invisible so that the users don't have to see it twice).&nbsp;&nbsp;Now right click on the field and select properties.&nbsp;&nbsp;Go to the Event tab and select the field Before Update.&nbsp;&nbsp;Now click ... and select Code Builder.&nbsp;&nbsp;Your code should look something like this:<br>Me![RawItemNo] = [Forms]![frmMain]![RawItemNo]<br>This tells Access to pull the item no from your main field and display it on your subform.&nbsp;&nbsp;We are going to make it invisible, but what it will do is link the item number from your main form to the description on your subform.&nbsp;&nbsp;Now right click the field again and select properties.&nbsp;&nbsp;Change the Invisible field and the Tab Stop field to NO.&nbsp;&nbsp;Finally, go to your main form in design view, and right click - select properties - on your subform.&nbsp;&nbsp;Go to Link Master Field and Link Child Field - fill in the RawItemNo field in here.&nbsp;&nbsp;Now when you enter an item number in your main form, <br>Access will duplicate it to the invisible field in your subform, and pull up the related description.&nbsp;&nbsp;Hope this helps!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top