Results 1 to 4 of 4

Thread: button event problem within TabPage

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    2

    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.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: button event problem within TabPage

    Welcome to VBForums

    Thread moved from the 'VB.Net' forum to the 'Office Development/VBA' forum.

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    2

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width