Mike Rudolph
asked on
Access DoCmd.Close Run-time error '13' type mismatch
Experts,
Not why I am getting this error message.
Debug highlights on DoCmd.Close "Welcome"
Of course when I just use DoCmd.Close the form that just opened is closes.
I really just want to open the frmVisitorlog and close the Welcome forms. I even tried to reverse the two lines and I still get the same message.
How can I fix this?
Thanks!
Not why I am getting this error message.
Debug highlights on DoCmd.Close "Welcome"
Of course when I just use DoCmd.Close the form that just opened is closes.
I really just want to open the frmVisitorlog and close the Welcome forms. I even tried to reverse the two lines and I still get the same message.
How can I fix this?
Thanks!
Private Sub Command21_Click()
DoCmd.OpenForm "frmVisitorLog"
DoCmd.Close "Welcome"
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry, it should be read as
Or, if the command button is in a form "Welcome", you may use the codes below as well:
Or, if the command button is in a form "Welcome", you may use the codes below as well:
shogun5,
<No points needed>
FarzadA suggestion surely solves the issue. Considering that you mention about reversing the two lines, I posted here the other way. Just for information and reference purposes.
Sincerely,
Ed
<No points needed>
FarzadA suggestion surely solves the issue. Considering that you mention about reversing the two lines, I posted here the other way. Just for information and reference purposes.
Sincerely,
Ed
ASKER
FarzadA,
Yep! That was it. May I ask why this will work
DoCmd.OpenForm "formName"
but I get an error here:
DoCmd.Close "Welcome"
and much add acForm like
DoCmd.Close acForm "Welcome" ?
Thanks!
Yep! That was it. May I ask why this will work
DoCmd.OpenForm "formName"
but I get an error here:
DoCmd.Close "Welcome"
and much add acForm like
DoCmd.Close acForm "Welcome" ?
Thanks!
Hello,
DoCmd.OpenForm knows that it must open form so you need only pass form name to it. But DoCmd.Close closes more than form objects. You must pass what type of objects that you want close. Passing form name instead of object type will cause type mismatch in passing arguments to DoCms.Close method.
-FA
DoCmd.OpenForm knows that it must open form so you need only pass form name to it. But DoCmd.Close closes more than form objects. You must pass what type of objects that you want close. Passing form name instead of object type will cause type mismatch in passing arguments to DoCms.Close method.
-FA
ASKER
FarzadA,
Thank you. I understand now.
Mike
Thank you. I understand now.
Mike
Private Sub Command21_Click()
DoCmd.Close
DoCmd.OpenForm "frmVisitorLog"
End Sub
Sincerely,
Ed