D
Dennis
Hi,
I'm running Access via Office XP Pro on Windows 7.
I've already read the other forum discussion on this subject & I'm still
having a problem.
I have a form called frmWarranty_Search. It can be run from either a main
menu program (in which case the OpenArgs is set to ""). Or it can be run
from other programs (in which case the calling program's name is set in
OpenArgs).
In the form, I have a close button. Here is the code:
-------- S t a r t C o d e ------------
Private Sub cbClose_Click()
If pstrCalledBy = "" Then
DoCmd.Close acForm, Me.Name ' Close
the form
Else
Me.Visible = False ' Hide
the form & let calling form close
End If
End Sub
----------- E n d C o d e -------------------
pstrCalledBy is set by the OnLoad event. If OpenArgs = "", then this
variable is set to "" otherwise it has the name of the calling program.
When I run the form directly the the Access forms menu or calling it from
one of the programs, I receive the following error when I hit the close
button:
Microsoft Visual Basic
Run-time error '2501'
The Close action was canceled.
I the have a End, Debug, or Help button.
I hit the debug button and it takes me to the line:
DoCmd.Close acForm, Me.Name ' Close
the form
I lookup up the value of me.name and it is the form name.
I also changed Me.Name to cpstrFormName, which is a constant with the form'a
name.
I still received the same error. How do I fix this?
Thanks,
Dennis
I'm running Access via Office XP Pro on Windows 7.
I've already read the other forum discussion on this subject & I'm still
having a problem.
I have a form called frmWarranty_Search. It can be run from either a main
menu program (in which case the OpenArgs is set to ""). Or it can be run
from other programs (in which case the calling program's name is set in
OpenArgs).
In the form, I have a close button. Here is the code:
-------- S t a r t C o d e ------------
Private Sub cbClose_Click()
If pstrCalledBy = "" Then
DoCmd.Close acForm, Me.Name ' Close
the form
Else
Me.Visible = False ' Hide
the form & let calling form close
End If
End Sub
----------- E n d C o d e -------------------
pstrCalledBy is set by the OnLoad event. If OpenArgs = "", then this
variable is set to "" otherwise it has the name of the calling program.
When I run the form directly the the Access forms menu or calling it from
one of the programs, I receive the following error when I hit the close
button:
Microsoft Visual Basic
Run-time error '2501'
The Close action was canceled.
I the have a End, Debug, or Help button.
I hit the debug button and it takes me to the line:
DoCmd.Close acForm, Me.Name ' Close
the form
I lookup up the value of me.name and it is the form name.
I also changed Me.Name to cpstrFormName, which is a constant with the form'a
name.
I still received the same error. How do I fix this?
Thanks,
Dennis