Link to home
Start Free TrialLog in
Avatar of Justin
Justin

asked on

Access 2010 "On Mouse Move" event not working

Hello Experts,

I'm having a problem with my event code in Access 2010.

I can't seem to get any code to run in several events. These events include: On Mouse Move, On Click, On Mouse Up, On Mouse Down, On Mouse Wheel.

I was having the same problem with "On Key Press", but that was resolved by setting "Key Preview" to "Yes"

In addition to the On Key Press event, I do have some other events setup: Before Update, and On Timer.

The code I have been using for testing is to just to open a test form. But it just won't work.

What is stopping my code from running?

Thanks in advance.
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Is your database in a trusted folder?

Are you sure you are using a form view which allows events and not say, 'layout view' which does not.
Avatar of Justin
Justin

ASKER

Thanks for your reply peter57r,

I'm not the best at access, but I'll give you the best information I can:

The accdb front end file is on my desktop at the moment, and the back end is on a mapped drive, and I'm logged in as Administrator - I should have full access. When I make copies of the front end and open for the first time, it asks me to enable content. Which I do. I don't get asked this again after the first time.

In the current database settings, I have layout view disabled. Pretty sure I'm viewing the form as it should be, and as the end user sees it.

Other event code works, just not anything to do with the mouse, so it appears. I tried getting a message box to appear "On Click" on another form, but that doesn't work either.

Thanks again,

Justin
ASKER CERTIFIED SOLUTION
Avatar of peter57r
peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Justin

ASKER

Thanks peter57r! You nailed it.

I was using the form events. I tried using the "On Mouse Move" event under the "Detail" property, and I was able to get it working first go.

I need the code to fire whenever there is user action (I'm building an inactivity function). Would the detail property be sufficient for this? Or is there something better?

Thanks again,

Justin
I have always used textboxes to detect mouse activity , on the few occasions it has been required.  But my requirements have always required me to know which box was being 'mouse-overed'.  I haven't used it just to see if someone is just waving the mouse around.
Avatar of Justin

ASKER

Thanks again peter57r, I got it all working.

Because the database I'm working on is for primarily for a touchscreen computer, there isn't much "mouse movement". I was hoping it would pick up when a button was clicked or textbox selected, so I didn't have to put code or macros on every button / textbox.

I did however end up putting code/macro on everything that might be selected, to update the timerinterval property. If the timer elapses, (due to no user action) it saves/discards/closes all forms and brings up a login window.

It might not be the best way to do it, but it works. :D