I am recreating an OCX UserControl in VB6 I did many years ago. It is basically a series of buttons to be used in an MS Access 2003 form. The UserControl provides standardized functions to navigate the records, add, edit, delete, save and undo. It is also aware of the application and security context.
As I said, I developped and used such a control many years ago but I don't have the source code anymore.
I created the UserControl and dropped it in the Access Form. Clicking on the buttons will raise the events and perform the appropriate action.
However, the control does not received the form's events.
The code snippet from the control below illustrates that I declared a module variable withEvents to hold the form reference. This variable is initialized in the Show event handler of the userControl. It is used by the cmdAdd_click event to move the form to a new record (this is working). The form also received the events raised by the control (such as BeforeAdd and AfterAdd). However, the m_ParentForm_Current event is never fired (as any other form events I've tried).
I think it may be some configuration on either the VB6 or Access side.
I compiled the userControl in both Apartment and Single threaded modes without difference in the result.
Dim WithEvents m_ParentForm As Access.Form
Dim m_AccessApp As Access.Application
Private Sub UserControl_Show()
If Ambient.UserMode Then
Set m_ParentForm = Extender.Parent.object
Set m_AccessApp = m_ParentForm.Application
Private Sub cmdAdd_Click()
Dim wCancel As Boolean
wCancel = False
If Not wCancel Then
m_AccessApp.DoCmd.GoToRecord acDataForm, m_ParentForm.Name, acNewRec
Private Sub m_ParentForm_Current()