Field in subform to mimic field on form (1 Viewer)

JeffreyDavid

Registered User.
Local time
Today, 07:06
Joined
Dec 23, 2003
Messages
63
:confused:
I have a form with a subform, and in the subform I have a text box (ProjectNo) that I want to mimic a textbox on the form (ProjectNo). All of the fields in my subform are bound fields so I need to add the ProjectNo to each line in the subform or there will be no Orders associated to the ProjectNo. See the ProjectNo is my Primary Key in both tables. The subform saves to the Project table and the form saves to the Orders table. I have tried to add the linking criteria in the query but got no results and I had it in the Control Source but then the field was not bound anymore so in my Project table I had a bunch of orders with no ProjectNo. Or is there a way to have code like 'ProjectNo = Forms![NewProject]![txtProjectNo]'.
By the way, this code here doesn't work.
Thanks
 

jfgambit

Kinetic Card Dealer
Local time
Today, 07:06
Joined
Jul 18, 2002
Messages
798
In the subform set the ProjectNo "DEFAULT VALUE" to be:
[Forms]![NewProject]![txtProjectNo]

HTH
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:06
Joined
Feb 19, 2002
Messages
43,607
You do not need to show the foreign key value on the subform record at all. Nor, do you need to specify a value for it. All you need to do is to specify the master/child link fields correctly and Access will take care of populating the foreign key value when a new row is added to the subform's table.
 

Users who are viewing this thread

Top Bottom