Subform Foreign Key Auto Entry

Swift_74d

Board Regular
Joined
Aug 19, 2009
Messages
148
Quick question that i simply can't figure out...

I have a main form set up to allow the choice of an existing, or the entry of a new, employee from a table. This choice fills a sub form (continuous forms) with all the entries from another table. I would like to know if its possible that when the user begins to enter a new record in the subform if the foreign key can be automattically filled based on the primary key of the main form.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Set the default of the foreign key field to the value of the primary key from the main form.

You might need code for that but it's relatively straightforward.

Oh, and you migh need to add the foreign key field to the form, but you can just hide it.
 
Upvote 0

Forum statistics

Threads
1,224,593
Messages
6,179,791
Members
452,942
Latest member
VijayNewtoExcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top