Hello Access Programmers,
I have a form that has a button that opens a modal form on top allowing the user to perform a task, when done the modal form closes, returning the user to the underlying form to continue their work.
That modal form creates some information that I would like to transmit to the underlying form.
In this thread, http://www.access-programmers.co.uk/forums/showthread.php?t=198302 bob suggests a public function on the main form called by a line on the modal form. Here is what I created to accomplish this.
Main Form
Modal (popup) Form
Access does not like the red line. Where am I going wrong?
Thanks for looking at this.
I have a form that has a button that opens a modal form on top allowing the user to perform a task, when done the modal form closes, returning the user to the underlying form to continue their work.
That modal form creates some information that I would like to transmit to the underlying form.
In this thread, http://www.access-programmers.co.uk/forums/showthread.php?t=198302 bob suggests a public function on the main form called by a line on the modal form. Here is what I created to accomplish this.
Main Form
Code:
Public Sub SetCombos(varEID As Variant, varCID As Variant)
Debug.Print "varEID: " & varEID
Debug.Print "varCID: " & varCID
End Sub
Modal (popup) Form
Code:
Private Sub btnSave_Click()
DoCmd.RunCommand acCmdSaveRecord
[COLOR=green]' call public procedure on main form[/COLOR]
varEID = Me.EID
varCID = Me.CID
[COLOR=red]Forms!frmMain.SetCombos(varEID, varCID)[/COLOR] [COLOR=green]' Access will not accept this line[/COLOR]
[COLOR=green] ' (Compile error: Expected: =)[/COLOR]
DoCmd.Close acForm, "frmPopup", acSaveNo
End Sub
Thanks for looking at this.