Need help with passing ID back to parent form

C

Cameron

Intially I pass the employee ID to a popup form to edit the employees family
particuplars. What I would like to do is when the user closes the popup form
using the close button, that the record pointer on the parent form is the
record the user intially clicked. So basically have to transfer the ID from
the popup back to the main form, but the main form is intially populated via
an embedded query.

How would I code this? And what events would I call to get this to work?
 
S

Stefan Hoffmann

hi Cameron,
Intially I pass the employee ID to a popup form to edit the employees family
particuplars. What I would like to do is when the user closes the popup form
using the close button, that the record pointer on the parent form is the
record the user intially clicked.
Why does the parent form change at all?


mfG
--> stefan <--
 
K

Keith Wilby

Cameron said:
Intially I pass the employee ID to a popup form to edit the employees
family
particuplars. What I would like to do is when the user closes the popup
form
using the close button, that the record pointer on the parent form is the
record the user intially clicked. So basically have to transfer the ID
from
the popup back to the main form, but the main form is intially populated
via
an embedded query.

How would I code this? And what events would I call to get this to work?

Are you closing the main form when the popup opens? That's the only reason
I can think that it's data would change (on re-opening). Try setting it's
visible property to false instead of closing.

Regards,
Keith.
www.keithwilby.com
 
C

Cameron

This function opens the child form
DoCmd.OpenForm "EmployeeSkills", acNormal, , "[EmpID] = " & Me.EmpID, , , "ID"
But when the child form closes the record that triggered the above code
doesn't have focus. Instead the form repaints and the pointer repositions to
the top of the parent form.
 
K

Klatuu

First you said popup form then you said child form. What is a child form?
Is there, perhaps, a Requery in the EmployeeSkills form that might be
executing during this process?

When does the EmployeeSkills form return to the first record in the
recordset? When you open the popup or when you close it?
--
Dave Hargis, Microsoft Access MVP


Cameron said:
This function opens the child form
DoCmd.OpenForm "EmployeeSkills", acNormal, , "[EmpID] = " & Me.EmpID, , , "ID"
But when the child form closes the record that triggered the above code
doesn't have focus. Instead the form repaints and the pointer repositions to
the top of the parent form.

Keith Wilby said:
Are you closing the main form when the popup opens? That's the only reason
I can think that it's data would change (on re-opening). Try setting it's
visible property to false instead of closing.

Regards,
Keith.
www.keithwilby.com
 
Top