Full Version: Scrolling a continuous form
UtterAccess Forums > Microsoft® Access > Access Forms
Shane
Is there any way to control the scroll position of a continuous form. I am trying to create a continuous form where the current record is always at the top of the form. By default a continuous form only scrolls down the minimum amount and so the current record is always at the bottom of a continuous form when the user is moving down through the records.
Thank you for your time
Shane
DoubleD
I've got a clumsy way.
You know how many records appear on your screen at a time. Loop a GoToRecord.MoveNext the appropriate number of times, then move the focus back to your selected record. It's a bit clumsy, but I'm pretty sure it will work.
Shane
Thank you for this.
urrently I am moving to the last record and then using docmd.gotorecord previous until I am back at the correct record. This works except that for longer lists the user can see the scroll from the bottom. I had hoped that there would be a better way to do this.
Your suggestion will reduce the number of records to scroll through so this should be an improvement on my current solution.
Thanks
Shane
DoubleD
Just one other thought. Identify the record number of the record you want to go to.
Add the number of records shown on the form to the identified record number.
Go to the new record number, then set the focus on the desired record number.
This should happen so quickly the user shouldn't see anything happening, as you're only touching two records.
EFCoins
How do you know how many records there are on the screen?
Shane
Good question, You don't really know how many records there are.
I do know the length of my continuous form (in my case six records) but there could be less than a full forms worth of records. If I where to try and goto a records that is not there (eg. docmd.gotorecord , , acNext, 5 and there are not five records) then I get an error.
The solution I have now implemented is as follows
On Error GoTo LastRecreached
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acNext
DoCmd.GoToRecord , , acNext
LastRecreached:
On Error GoTo 0
Do Until RefID = Forms!MyFrm!RefID
DoCmd.GoToRecord , , acPrevious
Loop
This works reasonable well but Double Ds last suggestion could work even better provided that errors due to running out of records are handled or avoided.
Perhaps something like this
On Error goto LessThan5Records
docmd.gotorecord , , acNext,5
OnError goto 0
docmd.gotorecord, , acprevious,5
Exit sub
LessThan5Records:
OnError goto 0
docmd.gotorecord , , acLast
Do Until RefID = Forms!MyFrm!RefID
DoCmd.GoToRecord , , acPrevious
Loop
I haven't tried this yet so apologies if there are bugs in it. I hope that the ideas will be of use to others.
Thank you for all your help
Shane
max5007
hi all, may i know how to disable the mouse scroll function?
ean that i don allow people use mouse scroll to search the item
thanks a lot
EFCoins
So the user can not resize your forms, if the form always has room for 6 records. Seems a big restriction on your form.
paulleeson
to disable the Mouse Scroll function
Search for Mousehook in google.
Hope this helps, I have been using it with no problems.
Paul
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.