Unanswered: Button on tab control to open and pass id to pop up form
I have a form, "frmClientDashboard" with a tab control on it. On one of the tab pages "Employment History", I have placed a command button, "cmdAddJob" which I want to a) open a pop-up modal form "frmAddEmploymentHistory" and b) pass the value of the current record's primary key "Client_ID" in frmClientDashboard to the pop up so that a fresh employment record can be created for that client and added to the tblEmployment table (the FK in tblEmployment is called "Employment_ClientID").
On the same tab page as the button is a subform looking at tblEmployment, so, ideally, once the user has added a new job using the pop up, they would click Save & Close on the pop up and return to the tab control page on the main form to see the new job added to the subform window.
Well, that's the plan anyway...BUT, I'm stuck at the open the pop-up part, or rather, the successful passing of the current record's id field to it. The pop up opens, and I can add a new job record, and that record saves to tblEmployment, but the Client ID does not get passed, and so it is not associated with the client.
I'm posting my db. I'm working in Access 2007.
Thanks in advance for any assistance you all can offer!
You've got the right idea, just need to talk it out (pseudocode) to make things work right:
click button on main form
Button code should open new form and pass clientid as argument
new form open should process that argument and create the new record.
When the user clicks another button on the form (save and close), it should do what it's supposed to and then requery the subform on the main form.
Looking at your db, you're almost there. Don't pass the whole "[Employment_ClientID] = " part, just the ID.
You need to put in some code in the Form_Open event on the AddEmpHistory form so process the Client ID (which can be referenced by Me.Openargs)