I gave the user the ability to open a form in modal to put in information about a change on the main (non modal) form.
The modal form displays when the user updates a combo box.
The problem is, when the click the Cancel the button on the modal form I want do an undo on the main form to reset the data back the way it was before the update on the combo box.
I have tried using a public variable to indicate the form needs to be refreshed. The problem is I can't get the focus back to the main form. Any suggestions. Existing code below (a bit messy as I keep fudging with it).
Open the modal form
Private Sub cboWorker_AfterUpdate()
DoCmd.OpenForm "frmWorkerChangesMod"
End Sub
go to the public sub (the variable are declared elsewher)
Private Sub cboWorker_BeforeUpdate(Cancel As Integer)
wrkrid = Me.cboWorker.Column(0)
NotSaved = 2
Call fldUndo(wrkrid, NotSaved)
End Sub
The public sub
Public Sub fldUndo(wrkrid, NotSaved)
If NotSaved >= 1 Then
Forms![frmCompanyInformatino]![CompanyCrewMember] = wrkrid
End If
DoCmd.Close acForm, "frmWorkerChangesMod"
End Sub
Any suggestions would be appreciated