Results 1 to 9 of 9
  1. #1
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228

    Possible to scroll through ListBox without setting focus?


    I am just curious if it is possible to be able to scroll through a ListBox with just a mouseover? Or, do you need to set focus on the ListBox before being able to scroll?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,629
    That would probably involve MouseMove event of the form. No idea what the code would be like except probably complicated.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    Did a little research and found out that it is possible to do a setfocus while mousing over. Is it possible to somehow keep track of my previous control? When I move outside the listbox, I would like to return to the previous control.

  4. #4
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    I suppose to clarify, is it possible to keep a global variable while the form is open that will change according to the control.name property without requiring a timer loop to check ActiveControl or also requiring adding a OnGotFocus event to every control?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,629
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    This actually seems to be quite simple using the previouscontrol function. However, I want to set the trigger to go back to the previous function to be on the activeform.detail.onmousemove property. However, I do not want this to continue non-stop while I am hovering over "detail".

    I set this into a Macro.

    Code:
    Function MouseOver()
    
    Screen.PreviousControl.SetFocus
    Screen.ActiveForm.Detail.OnMouseMove = ""
    
    
    End Function
    And when you hover over the listbox, this runs.

    Code:
    Private Sub List2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Me.List2.SetFocus
    Me.Detail.OnMouseMove = "........"
    End Sub
    This is where I am unsure how to make a reference to the macro containing the first function.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,629
    Sorry, I am lost and no interest in figuring it out. I wish you luck.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    kdbailey is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2012
    Posts
    228
    All I want to know is how to set an event to trigger a function through VBA.

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,629
    A Function is designed to return a value to calling procedure and therefore must be part of an equation:

    x = MyFunction()

    For a function to return a value:

    Function MyFunction()
    'do some code
    MyFunction = something
    End Function

    What sort of value should be returned to the MouseMove?

    A Sub can simply be invoked.

    Call MySub

    Either procedure can be designed to require arguments.


    BTW, these are not macros, they are VBA procedures.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Opening a report and setting focus to it
    By Kirtap in forum Programming
    Replies: 2
    Last Post: 02-19-2014, 12:05 PM
  2. Setting the focus on a subform
    By Paul H in forum Forms
    Replies: 3
    Last Post: 01-10-2012, 09:17 AM
  3. Setting focus on a tabbed form
    By crowegreg in forum Forms
    Replies: 21
    Last Post: 08-27-2011, 09:22 AM
  4. Replies: 1
    Last Post: 12-10-2009, 09:58 PM
  5. Setting Focus on a Form
    By MFeightner in forum Forms
    Replies: 1
    Last Post: 07-30-2009, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums