justinhaynes
asked on
calling variables from subs.
I have this in a module:
-----------
Public Sub Open_Next_Form(thisformnam e, nextformname)
MsgBox thisformname
MsgBox nextformname
GlobalCustomerID = thisformname.ID
thisformname.Form.refresh
DoCmd.OpenForm nextformname
End Sub
--------------
I call it this way:
-----------------
Private Sub btnConsumerDebt_Click()
MsgBox Form.Name
nextformname = frmDebtsConsumer
Call Open_Next_Form(Me.Form, nextformname)
'GlobalCustomerID = ID
'Form.refresh
'DoCmd.OpenForm "frmDebtsConsumer"
End Sub
------------------
When I click this button I get a Type Mismatch at "msgbox thisformname"
When I comment out the msgboxes, I get:
"runtime error 2494: The action or method requires a form name argument"
at
DoCmd.OpenForm nextformname
Thanks.
-----------
Public Sub Open_Next_Form(thisformnam
MsgBox thisformname
MsgBox nextformname
GlobalCustomerID = thisformname.ID
thisformname.Form.refresh
DoCmd.OpenForm nextformname
End Sub
--------------
I call it this way:
-----------------
Private Sub btnConsumerDebt_Click()
MsgBox Form.Name
nextformname = frmDebtsConsumer
Call Open_Next_Form(Me.Form, nextformname)
'GlobalCustomerID = ID
'Form.refresh
'DoCmd.OpenForm "frmDebtsConsumer"
End Sub
------------------
When I click this button I get a Type Mismatch at "msgbox thisformname"
When I comment out the msgboxes, I get:
"runtime error 2494: The action or method requires a form name argument"
at
DoCmd.OpenForm nextformname
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm glad I could help out. I noticed from your member profile that you've been around for a while, but this is your first question. I've found this site extremely helpful in helping me through the learning curves on many of my projects. Many minds are better than one anyday!
Good luck :-)
Good luck :-)
ASKER
thanks again, mbizup.