Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 54
  1. #16
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Oops, I thought I'd copied and pasted as well. Have corrected my previous post!

    Next task is to apply the method to updating an image and textbox as in my example app from post #6 link but that probably won't be for a few days due to other commitments
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  2. #17
    Remster is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2010
    Posts
    317
    OK, I haven't quite got my head round it, but the issue seems to be something to do with this.

    Detail_Paint is triggered once for each visible record in a continuous form. So when, as is the case for me at the moment, 31.5 records are visible (Bobby Adens to the top half of Rocky Belsner), Detail_Paint is triggered 32 times.

    Now, when there's no header, Me.CurrentSectionTop is greater than 0 on the first paint only, so the condition that leads to the rest of the code is satisfied only once. But when there's a header, Me.CurrentSectionTop is always greater than 0, so the condition is satisfied at least 32 times – more if you're scrolling through the list at speed. Among other things, PlayerDetails is requeried at least 32 times.

    One thing you might have noticed is that even factoring in Me.Section(acHeader).Height doesn't make things run as smoothly as when there's no header (I wasn't aware of this until I switched to a different PC this afternoon). The reason seems to be that Me.Section(acHeader).Height is 284 twips, whereas Me.CurrentSectionTop is 288 twips even when the current record is at the top. This can be solved in an ad hoc way by replacing "Me.Section(acHeader).Height" with "Me.Section(acHeader).Height + 4", but I haven't thought about whether there's a neater way of managing it (perhaps by allowing for any small difference between the two).
    Last edited by Remster; 07-07-2022 at 08:40 AM. Reason: Corrections

  3. #18
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Thanks but I'm still struggling to understand what is happening with this code.
    I've applied EXACTLY the same code to my own example app which has a second subform with a textbox and an image control and am again getting the random scrolling problem. As yet, no idea why.

    After over a year & 18 posts, nobody else has got involved & if nobody else is interested it may be appropriate to switch to email / PM to continue . . . at least until this is solved / fully understood.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #19
    Remster is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2010
    Posts
    317
    Nah, let's keep it public.

    Does the random scrolling occur when you click once on the down-arrow, or only when you drag the tab over more than one screen of records?

    Can you share your example app, or a stripped down version of it?

  5. #20
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    I am lurking. Suggest it stays public. There may be interest. people often watch hoping for a solution or at least an explanation.

  6. #21
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    That make two lurkers!

    (is there a collective noun for a group of lurkers?)
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #22
    Remster is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2010
    Posts
    317
    Thanks. I do actually think I can explain it, but I want to be clear on what the user is doing before I embark on a more detailed explanation.

  8. #23
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Sorry I've only just noticed all the replies & the pair of lurkers ....

    I had a problem with error 2455 which triggered the random scrolling
    The cause was the use of Form in my equivalent of this line Me.Parent!PlayerDetails.Form.Requery from the original db
    Although that didn't error in the original db, I removed that as its not needed.

    Better still, when I do so, I no longer get error 2455 in my own db.
    Anyway I've now got it working

    Example database attached has two main forms:
    1. frmListbox where moving the mouse over the list causes the associated image & 'tooltip' to be updated
    This is described in my recent web article Listbox Mouse Move Item Tooltips (isladogs.co.uk)

    2. frmScrollbar where I was trying to replicate similar behaviour using a subform scrollbar without physically selecting the subform records
    This now does what I wanted as well

    Many thanks to @remster for triggering my interest in this topic

    Back to you for the explanation
    Attached Files Attached Files
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  9. #24
    Remster is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2010
    Posts
    317
    I've discovered I lack the brainpower to think this through in detail, so I'll just make some more observations.

    Suppose you open the form and then drag the thumb/tab down to Bobson Dugnutt, who's way off the bottom of the screen. Here are some of the things that will happen:

    1. Every record from Jerry Aiggins (second in the visible list) to the last in the visible list when Bobson Dugnutt is first will be painted.

    2. Because Me.CurrentSectionTop will always be greater than 0 (because of the header), Me.Recordset.Move will always occur.

    3. Because of the header, Me.Recordset.Move will always move to the record one position before the first in the visible list (that's how the formula "-Round(Me.CurrentSectionTop / Me.Section(acDetail).Height" will work out).

    4. Because Me.Recordset.Move will bring into view the new current record if it isn't already in the visible list, another series of paintings will be triggered (as per 1 above).

    Sorry I can't do better.

  10. #25
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Thanks. no need to apologise
    It certainly is difficult to explain in detail though your original explanation in post #1 is probably enough for most people.

    Two more observations which may serve to confuse things further:

    1. The code still works if the line
    Me.Recordset.Move -Round((Me.CurrentSectionTop - Me.Section(acHeader).Height) / Me.Section(acDetail).Height)
    is incorrectly written as
    Me.Recordset.Move -Round((Me.CurrentSectionTop - Me.Section(acDetail).Height) / Me.Section(acDetail).Height)

    2. Both your version from post #2 (with a header) and mine from post #23 work perfectly on my desktop PC
    However I just tested both on a slower tablet PC. There was some instability with your version and uncontrollable scrolling on mine with the images when the form opens (even before using the scrollbar).
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #26
    Remster is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2010
    Posts
    317
    1. Surely this is because the header and detail sections are the same height (5.01 cm).

    2. Have you allowed for what I described in the final paragraph of #17?

  12. #27
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    1. I had adjusted the header height. It still works even where the header is twice the height of the detail
    2. Yes - I'd already tried that as well - no improvement

    UPDATE:
    Decompiled & compacted. Rebooted tablet.
    Its now stable & working. Hooray.
    No idea what the issue was before but its now fixed

    AFAIAC, this now appears to be working correctly on both devices with the following code

    Code:
    Private Sub Detail_Paint()
    
       If Me.CurrentSectionTop > Me.Section(acHeader).Height + 4 Then
            Me.Recordset.Bookmark = Me.Bookmark
            Me.Recordset.Move -Round((Me.CurrentSectionTop - Me.Section(acHeader).Height - 4) / Me.Section(acDetail).Height)
        End If
    
    End Sub
    Also, I've added code to prevent error 2542 (invalid reference to the Parent property if someone tries to open the subform referencing the parent form from the nav pane

    Code:
    Private Sub Form_Open(Cancel As Integer)
      
        If Application.CurrentObjectName = Me.Name Then
            MsgBox "This form is designed to be used with other forms.   " & vbCrLf & vbCrLf & _
                "It cannot be opened directly from the navigation pane   ", vbExclamation, "Action not allowed!"
            Cancel = True
            Exit Sub
        End If
    
    
    End Sub
    Attached Files Attached Files
    Last edited by isladogs; 07-09-2022 at 07:50 AM. Reason: Additional info & attachment
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  13. #28
    Remster is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2010
    Posts
    317
    That's a relief, because I was unable to replicate what you'd described.

    For information, I've found that when the current record is the top one, sometimes Me.CurrentSectionTop is greater than Me.Section(acHeader).Height, sometimes it's less, and sometimes it's the same. I mean that it varies according to the header height, not that it changes within the same version of the form.

  14. #29
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I'll check out your observations regarding the top row.

    For info, I'm intending to include this approach as an alternative solution to that in my Web article Listbox Mouse Move Item Tooltips (isladogs.co.uk).
    I will, of course, clearly reference this thread and you as its author.

    I'd be interested to know how you first came across this method. It was new to me, though perhaps not to others
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  15. #30
    Remster is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2010
    Posts
    317
    Thank you.

    I can't remember the exact circumstances, as it was a couple of years ago. I'd been asked to create an Access database for an HR team at work, and I became obsessed with trying to achieve something like this (the listed people were members of staff rather than fictional baseball players). I think at first I was just looking for any event that was triggered when the scrollbar was moved, which led me to Detail_Paint. After that I was probably looking for anything that changed during painting; maybe I tried the equivalent of "Debug.Print Me!Player.Value" and observed the results.

Page 2 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-16-2018, 02:51 AM
  2. Vertical Scrollbar Appears At Random
    By lccrews in forum Access
    Replies: 3
    Last Post: 10-31-2017, 06:54 PM
  3. Missing Vertical Scrollbar
    By JeffChr in forum Forms
    Replies: 2
    Last Post: 11-21-2014, 07:54 AM
  4. Vertical scrollbar issues with a subform
    By vange2013 in forum Forms
    Replies: 1
    Last Post: 11-27-2013, 09:13 PM
  5. Vertical scrollbar in reports
    By Cedarguy in forum Reports
    Replies: 2
    Last Post: 11-07-2012, 03:15 PM

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