Close current form

latex88

Registered User.
Local time
Today, 06:33
Joined
Jul 10, 2003
Messages
198
I would like to write an event procedure that would apply to multiple forms? In this particular event, I'm going to assign a certain value to a variable, then afterwards, close the form if it's not a certain form. If a particular form activates this event procedure, I would like that form to remain open.

What is the code to check wether the current form that executed the event procedure is certain name and proceed with "DoCmd.Close , "" "
 
Dim frm As Form

For Each frm In Forms
If Not frm.Name ="YourForm"
Then
DoCmd.Close acReport, rpt.Name
Next
End If
 
Last edited:
thanks. I found that I must insert the below line first in order to work.

Set frmName = Screen.ActiveForm
 

Users who are viewing this thread

Back
Top Bottom