button event problem within TabPage
Hello,
First I'll note that I'm using VBA 6.5 for MS Access 2007.
(slight simplification for the sake of the question)
On my main Access form ('HRQOL') I have a TabControl containing two TabPages. The first TabPage ('Main') contains basic text input fields, and the second ('Followup') contains a list which I would like to be able to expand/shrink via a button on that second TabPage. Technically there are two buttons (Minimize, Maximize) with alternating visibility. I have tried catching/handling the 'On Mouse Up' event with a VB event procedure:
Private Sub Maximize_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
( for selected list elements set visibility to True)
Private Sub Minimize_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
( for selected list elements set visibility to False)
A button click though, produces the following error:
The expression On Mouse Up you entered as the event property setting produced the following error: A problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX Control.
As part of this whole process the button was initially inside a subform 'Followup1' that is on the TabPage 'Followup'. With that arrangement the button was able to fire an event properly, but once it was moved out of the subform (the more appropriate design) all hell broke lose.
I also tried having the TabPage itself catch the event (rather than the button) based on position of the mouse click but this also fails spectacularly because now every mouse click on the TabPage leads to the error, not just the clicks over the button.
Is there an inherent problem with buttons on a tabpage?
My guess is not, I just haven't been able to find an good answer anywhere.
Thanks for reading.
Re: button event problem within TabPage
Welcome to VBForums :wave:
Thread moved from the 'VB.Net' forum to the 'Office Development/VBA' forum.
Re: button event problem within TabPage
you should only use the dropdown lists of events on the code pages to make sure the events are properly registered
if the buttons are moved, the events may have also moved to a different codepage
Re: button event problem within TabPage
westconn1, thanks for the reply.
Turns out the issue wasn't with the eventhandler being in the wrong place, or even with the TabPage. After endless head scratching and removing some components from the form the problem disappeared. On rebuilding the form it worked for a period of time until Access crashed (I don't know what I did or added to make it crash) and thereafter has continued to throw the prior ActiveX/OLE server error. Event's on the subform (located within a TabPage) cause the error; doesn't matter what the event is, they all cause the error.
My VBA refences (VB editor -> Tools -> references) haven't changed.
Is there a way to reset the ActiveX/OLE server?
Thanks