Reading a value from one form into another

  • Thread starter Thread starter movie_lover2001
  • Start date Start date
M

movie_lover2001

Guest
Hi,
I have a form with 1 subform in it. These are created to enter new records in the subform. When the user selects a record in the main form and tries to create a new record in the subform, I want to read the primary key value of main form into the foreign key field of the subform. I have tried:

Me![subformforeignkey].value = [forms]![mainform]![primarykeyfield]


but it gave me an error that it can't find the main form which is not true because the main form is open with subform with in. Please help....

[This message has been edited by movie_lover2001 (edited 04-14-2002).]

[This message has been edited by movie_lover2001 (edited 04-14-2002).]

[This message has been edited by movie_lover2001 (edited 04-14-2002).]
 
I normally refer to an item on a form as Forms!MainForm.Form!TextBox. I am not sure if that is the best syntax but it works.
 

Users who are viewing this thread

Back
Top Bottom