Problems to capture mouse_down event on a control within a form with lots of controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ricardo de Mila
    New Member
    • Jan 2011
    • 41

    Problems to capture mouse_down event on a control within a form with lots of controls

    Dear people, good afternoon...
    I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
    Than I need to discover what was the control clicked and then, take an action.
    In my case, I have a form and a subform inside it and the controls are inside this subform.
    I have tryed to use the property form_mousedown, but when a lable is clicked, the event in the form simply isn't executed.
    Can somebody help me to understand what can be done to solve the question?

    The workaround would be to write a routine for each event of each control and I wouldn't like to do that.
    Best regards
    Ricardo
  • isladogs
    Recognized Expert Moderator Contributor
    • Jul 2007
    • 479

    #2
    I'm slightly unclear what you are asking. Please confirm if the following is true
    1. You want to run a specific procedure when the mouse down event runs on any control
    2. You have tested using the Form_MouseDown event and it didn't do what you wanted

    You do need to create code for each control mouse down event as that is where you want something to happen
    To reduce the amount of code required, write a procedure e.g. RunMyRoutine and call that from each mouse down event, either in code or from the popery sheet

    Comment

    • jimatqsi
      Moderator Top Contributor
      • Oct 2006
      • 1288

      #3
      You cannot capture MouseDown events for a control on the form. "For a form, the user can generate MouseDown and MouseUp events by pressing and releasing a mouse button in a blank area, record selector, or scroll bar on the form."

      MouseDown events on controls are not captured on the form event.

      See this: https://learn.microsoft.com/en-us/of...mouseup-events

      Jim

      Comment

      Working...