Prev | Current Page 2007 | Next

Michael R. Groh, Joseph C. Stockman, Gavin Powell, and Cary N. Prague

"Access 2007 Bible"


Here??™s all of the code behind this simple dialog box:
Public Event FormClosing(Message As String)
Private Sub cmdOK_Click()
DoCmd.Close acForm, Me.Name
End Sub
Private Sub cmdCancel_Click()
txtSomeData.Value = Null
DoCmd.Close acForm, Me.Name
End Sub
Private Sub Form_Close()
If Not IsNull(txtSomeData.Value) Then
RaiseEvent FormClosing(txtSomeData.Value)
Else
RaiseEvent FormClosing(???No data???)
End If
End Sub
A public event named FormClosing is declared at the top of the dialog form??™s module. This event
returns a single argument named Message. The cmdOK_Click event procedure closes the form,
while the cmdCancel_Click event clears the contents of the text box named txtSomeData
before closing the form.
The FormClosing event is raised by the dialog form??™s Close event procedure, ensuring that the
event is raised whenever the form is closed. If the txtSomeData is not Null, the value of the text
box is passed by the FormClosing event, while a default message is passed if the text box??™s value
is Null.


Pages:
1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
London hotels hotel SPA herbata czerwona Boliwia Sincerity