- Local time
- Today, 03:59
- Joined
- Feb 19, 2013
- Messages
- 17,350
Using win11, Access 365 64bit
I have this simple bit of code:
Which has worked fine for many years, but I've discovered the above error can be generated in certain circumstances.
my monitors are setup like this
The issue is not so much the acchittest call, but what it does with what getcursorpos returns. If the form is on my laptop monitor (1) and is my main display, everything works fine. But if on one of my other monitors cursorpos generates a negative Y value.
with 1 being the laptop monitor and main display - so PT(0,0) is top left of that monitor
If I change the main display to be monitor 3 (my usual setup) and have the form on that monitor then the code runs fine. Move the form to one of the other monitors and it again fails.
On the other hand if I make monitor 2 my main display, then the code works on any monitor.
My conclusion is that acchittest will only accept positive X and Y values - if the form is on the far left of monitor 1 then the error returns if the cursor is in that location when the code is triggered (a negative X value).
My solution for now is to make monitor 2 my main display but would be interested to know if others have had this problem and if there is a workaround by adjusting PT
I have this simple bit of code:
Code:
Function setReconciled()
Dim PT As POINTAPI
GetCursorPos PT
Set YNctl = Me.accHitTest(PT.X, PT.Y)
End Function
Which has worked fine for many years, but I've discovered the above error can be generated in certain circumstances.
my monitors are setup like this
The issue is not so much the acchittest call, but what it does with what getcursorpos returns. If the form is on my laptop monitor (1) and is my main display, everything works fine. But if on one of my other monitors cursorpos generates a negative Y value.
with 1 being the laptop monitor and main display - so PT(0,0) is top left of that monitor
If I change the main display to be monitor 3 (my usual setup) and have the form on that monitor then the code runs fine. Move the form to one of the other monitors and it again fails.
On the other hand if I make monitor 2 my main display, then the code works on any monitor.
My conclusion is that acchittest will only accept positive X and Y values - if the form is on the far left of monitor 1 then the error returns if the cursor is in that location when the code is triggered (a negative X value).
My solution for now is to make monitor 2 my main display but would be interested to know if others have had this problem and if there is a workaround by adjusting PT