My first steps to learn how to use WithEvents in a class module.
Here's a simplified version of what I have in a class module called clsFrm:
ln the OnLoad events of a form with only one button I have this:
When I click the button (btnCloseme), nothing happens.
First question : What I'm doing wrong here?
Second question: I'm looking for some easy-to-understand tutorials for using WithEvents in Access classes. My google search didn't help that much. Can you share some sites that can be a good start point?
Thanks for any kind of advice.
Here's a simplified version of what I have in a class module called clsFrm:
Code:
Option Explicit
Private WithEvents m_form As Access.Form
Private WithEvents m_Closebtn As Access.CommandButton
Const fEvents As String = "[Event Procedure]"
Public Sub InitCls(frm As Access.Form, btn As Access.CommandButton)
Set m_form = frm
Set m_Closebtn = btn
m_Closebtn.OnClick = fEvents
End Sub
Private Sub m_Closebtn_Click()
MsgBox ""
End Sub
ln the OnLoad events of a form with only one button I have this:
Code:
Private Sub Form_Load()
Dim frm As New clsFrm
frm.InitCls Me, btnCloseMe
End Sub
When I click the button (btnCloseme), nothing happens.
First question : What I'm doing wrong here?
Second question: I'm looking for some easy-to-understand tutorials for using WithEvents in Access classes. My google search didn't help that much. Can you share some sites that can be a good start point?
Thanks for any kind of advice.
Last edited: