Hi,
I am trying to store the value from a control on one form in a global variable, open another form, change the value of a text box on the second form to the value of the global variable, and then requery the second form. I get an error when it tries to open the second form from the first. I am using DoCmd.OpenForm in the onOK event of the first form. The onOpen event of the second form runs a macro that calls a function. The function sets the value of the field on the second form to that of the global variable. Then, the macro tried to requery the form. Here is what my function looks like.
Public Function UpdateMaster()
Forms![Transfer to Other SAM].[Master Number].Value = masterNum
End Function
I try using the RunCode action in the macro to invoke this function, but I get the error.
Any suggestions?
Thanks,
Chris
I am trying to store the value from a control on one form in a global variable, open another form, change the value of a text box on the second form to the value of the global variable, and then requery the second form. I get an error when it tries to open the second form from the first. I am using DoCmd.OpenForm in the onOK event of the first form. The onOpen event of the second form runs a macro that calls a function. The function sets the value of the field on the second form to that of the global variable. Then, the macro tried to requery the form. Here is what my function looks like.
Public Function UpdateMaster()
Forms![Transfer to Other SAM].[Master Number].Value = masterNum
End Function
I try using the RunCode action in the macro to invoke this function, but I get the error.
Any suggestions?
Thanks,
Chris