Updating forms after data entry on another form

SimonSezz

Registered User.
Local time
Yesterday, 22:11
Joined
Jun 19, 2008
Messages
30
I have a form that shows employee details (frmEmpDetails) and it has a subform that shows a list of dependants (sfrmDependants), there is a button on frmEmpDetails, (cmdAddDependant) that when clicked, opens a new form (frmAddDependant), but frmEmpDetails stays open in the background. Once frmAddDependant is close, frmEmpDetails is back in view. The problem is that the sfrmDependants subform on frmEmpDetails doesn't show the new Dependant until I go to a different record on frmEmpDetails and then reload the record again.

I tried a DoCmd.Requery in the Form_Current function of frmEmpDetails and Access crashes.
 
Ya, requery causes a current event so that's an endless loop.

In the close or unload even of the add dependent form you can force a requery on the subform of the employee form using code something like

Code:
private sub form_unload(cancel as integer)
  Forms("YourEmployeeForm").YourSubformControlName.Requery
end sub
 

Users who are viewing this thread

Back
Top Bottom