Moving a field between forms

J

Jason

I've created to tables, Company and Project. Each Company can have
muliple Projects and the two tables are relted by a field called
CompanyID.

I've also created forms for both of these tables.

What I now want is there to be a button on the Company form that opens
the Project form and copies the CompanyID field from the current
Company table into the new Project table that just opened.

I've figured out the button and getting it to open a new form, I just
need to understand how to move the CompanyID field between the two
forms.

Thanks In Advance,
Jason
 
G

Guest

there are two ways
1. declare a global variable, on the on click event before you open the
project form assign the CompanyID to the variable
MyVariable=me.CompanyID

on the on load event of the project form you assign the value of the
variable to your field
me.CompanyID=MyVariable

2. on the on load event of the project form you can write

me.CompanyID=Forms![CompanyFormName]![CompanyID]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top