Copy Data from Main Form to Subform

nrego

Registered User.
Local time
Today, 08:12
Joined
Jul 27, 2012
Messages
14
I have a main form that populates data into table “tblCollectionTracking” and a sub form that populates data into table “tblCostRequest”. The relationship between the two tables is 1 to many. When the user clicks on the “Cost Request” button in the main form the sub form “frmCostRequestForm” opens. Can the field “Patt/SRE#” from the main form automatically populate in the sub form?
 

Attachments

  • cost request.jpg
    cost request.jpg
    104.5 KB · Views: 235
The second form is a "popup", it is not a subform. When you open the second form, use the where argument to pass in the Patt/SRE # (really bad field name - get rid of the spaces and special characters) and that will bring up any existing records. Then you need a line of code to handle new records:
In the BeforeInsert event -
Code:
Me.PattSRE = Forms!firstform!PattSRE
 
Hi Pat,

Thanks for the tips about the field name. This a database that was built by someone else and now I have to make changes. I have started to go back and rename fields to meet normalization rules.

I will try the code you gave me...
 

Users who are viewing this thread

Back
Top Bottom