Adding the on scroll event and detecting the first visible Id on continuous forms.

xavier.batlle

Active member
Local time
Today, 21:37
Joined
Sep 1, 2023
Messages
236
As far as I know, there is no easy way to detect when records are scrolled in a continuous form using the vertical bar for example.
This example attempts to fill this gap by using a class that detects when records are scrolled using a tricky method:

- In the details section, there is a dummy text box control bounded to the primary key of the table.

- The background and text of the control, both are painted using its ID value as color number.

- The class detects where the first dummy control is and checks its color; if the color of the dummy control changes, it means that the records are scrolling and an event is raised that can be handled by the form.

** Edited **
I've uploaded the version 12 because the previous version uploaded didn't work properly.
1771015255226.png
 

Attachments

Last edited:
sorry but your db crashes immediately upon opening the form frmTest on my winows 11, office 2024 x64.
 
Last edited:
sorry but your db crashes immediately upon opening in my winows 11, office 2024 x64.
Yes, you are absolutely right. Now fixed in version 12.
Thanks for let me know.
I apologize for the inconvenience.
 
Last edited:
the only challenge for you is how to make the DUMMY_CONTROL (currently the ID) "hidden". i tried to putting it "under" another textbox but it didn't work out.
 
the only challenge for you is how to make the DUMMY_CONTROL (currently the ID) "hidden". i tried to putting it "under" another textbox but it didn't work out.
With this approach, it is not possible to hide the "dummy control". This utility relies on the color of a pixel on the “dummy control,” so it has to be visible. You can try to make the “dummy control” quite small but always visible.
I would like to mention that there are some known issues that can be easily fixed, for example:
- When deleting a record.
- When adding a new record.

And other issues that, in principle, have no solution.
- This utility does not work if you resize the form and the dummy control is hidden. The recomended position for the "dummy control" is at the beginning of the detail section.
- Depending on the setup when there are multiple monitors involved, if MS Access is not on the main Windows screen, sometimes, the first "dummy control" color is not get properly.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom