Results 1 to 13 of 13
  1. #1
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111

    Prevent User From Scrolling Past a Certain Point on a Form

    Is it possible to prevent the user from scrolling past a certain point on a form? I know you can prevent scrolling altogether, but that's not what I want.



    Maybe something like putting a control in a spot and making it so you can't scroll past this control, i.e. placing a label somewhere that can't be scrolled past.

    I've tried searching for some information on this for a while but couldn't find anything, and I'm posting here to find out if that's because it doesn't exist and I'm a crazy person for wanting it, or if I just couldn't find it.

    Any help is always appreciated.


    Context, for those who want it:
    I have a form where the top and bottom half are very much related, but you don't always want / need one or the other. Sometimes you want both halves, sometimes you only want one, and I'd like a way to incorporate that. I tried disabling scrolling completely and setting the TabOrder to open on specific halves, but you can't fit everything on one screen (well, you can, but condensing things that much is not ideal)

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'd probably manipulate the record source, either returning the top or bottom halves as appropriate. I can't think of a way offhand to prevent scrolling part way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    This form isn't based on a RecordSource. It does have a RecordSource, but the controls and such on it are irrelevant to what that RecordSource is. I could change the RecordSource to litterally anything and nothing would change on the form at all.

    So unfortunately that's not gonna work for me.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I guess I'm not visualizing properly. How about a tab control, splitting the controls among 2 tabs? You can hide tabs if desired.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    Is that similar to the TabOrder of the form? If not I'm not entirely sure what that is.

    Regardless, could you point me to some information on that or explain how you would go about using it?

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Roland,


    Context, for those who want it:
    I have a form where the top and bottom half are very much related, but you don't always want / need one or the other. Sometimes you want both halves, sometimes you only want one, and I'd like a way to incorporate that. I tried disabling scrolling completely and setting the TabOrder to open on specific halves, but you can't fit everything on one screen (well, you can, but condensing things that much is not ideal)
    Perhaps you could have 2 forms and some control logic. The logic would depend on whatever you use to determine which half or both are required for the specific user.

    You might also have a table of users with the "required form part(s)"
    General logic:
    Code:
    IF user requires top form
          open top form
        (other validation logic would be included )
    END IF
    IF user requires bottom form
         open bottom form
         (other validation logic would be included )
    END IF

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by ItsRoland View Post
    Is that similar to the TabOrder of the form? If not I'm not entirely sure what that is.

    Regardless, could you point me to some information on that or explain how you would go about using it?
    No, not the same as tab order. You should see an icon in the controls area. It adds a tabbed section on the form, like at the top of this forum.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    As Paul said, use a Tab control. Fnd it on the ribbon Design Tab among the other controls. Other controls can be arranged on pages of Tab control. Placing other controls can be a little tricky to learn but once you get the hang of, sure you will like.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    So after messing around with it, this is actually even better than what I had in mind. Thanks for the help!

    I do have a few questions about this though.


    1. When you go from one tab to the other, does it run the OnOpen event? There's a bit of flickering when I go from one tab to the other, which leads me to believe it might be running the on open event when you switch tabs.

    2. How does it treat Tab Order with these? I can specify the .TabIndex property of controls normally but it doesn't seem to be working the same way it did before utilizing a Tab Control. Each Tab in the Tab Control has its own Tab Order, but this appears to be separate from the form's Tab Order. I tried something along the lines of "Me.TabCtrl.btnName.TabIndex = 0" but that doesn't work. If this isn't something you can do I can just use "Me.TabCtrl.TabIndex = 0" and go from there, just curious if I'm missing something.

    3. For some reason, one of my tabs will randomly scroll the screen down when I move to it. I feel like this has something to do with the Tab Order, but it only happens occasionally and I can't figure out what triggers it. It's never happened the first time I move to that tab, only the second and onward. -- Correction, this just happened the first time I moved tabs.

    4. I had to rebind all my buttons to their events after moving them into the Tab Control, which is fine, but I feel like its worth asking if all the code is still going to work the same. The controls being on different tabs shouldn't effect how the controls and code function, correct?
    Last edited by ItsRoland; 07-27-2018 at 07:36 AM. Reason: Added Questions 3 and 4, Tweaking issues

  10. #10
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    1. No but there is a Tab Control On Change event. This can be handy if you only want to load the contents of the tab when it's used. (Can speed up form opening / operation)

    2. Tab order is specific to the Tab page. The Tab control is exactly that a control on your form. I'm not sure what you are trying to achieve with "Me.TabCtrl.btnName.TabIndex = 0" ?

    3. I suspect you have a control somewhere down in that tab page that has a tab order meaning it gets focus, so the form scrolls.

    4. There is no reason your code should fail, each Tab page is simply an extension of the main form, so unless you were doing something very weird it should all still work.
    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 ↓↓

  11. #11
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    1. Any idea why the form flickers so much when I move tabs then? I should mention, it only does it for one of the tabs, and it appears to be reapplying formatting (color, caption, etc), but I could be wrong. it's not a huge deal, but I could see it getting hard on the eyes after flipping between tabs a few times.

    2. I was just trying to get the form to move to a certain point based on a control within the Tab Control. The "Me.TabCtrl.btnName.TabIndex = 0" was just something I tried out thinking maybe now the controls are considered 'within' the Tab Control if that makes sense. Regardless, I was able to achieve what I needed.

    3. You were right, I actually just found that right before I got the notification about your reply. It was listed on the Tab Order but I couldn't find it for a while, ended up getting placed behind another control somehow.

    4. I thought so, just wanted to make sure I wasn't going to overlook something that would mess me up later down the line




    Thanks for the help, I came here looking for one thing and left with something much better!

  12. #12
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Your flickering could be down to any conditional formatting being applied?
    This might sound weird but If you are applying changes in code, try and only make a change if its required. In other words, If a control is already red don't default it to Blue, then check it and find it needs changing back to red.

    Repainting controls or labels is not something Access is brilliant at, particularly on "busy" forms.
    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 ↓↓

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Ignore the tab control when referencing controls on its pages. Just reference them as if they were directly on the form.

    I do not have flicker.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-08-2017, 03:14 PM
  2. Replies: 3
    Last Post: 04-15-2017, 11:13 AM
  3. Replies: 4
    Last Post: 02-11-2016, 11:22 AM
  4. Prevent user adding duplicate data in form
    By littlejnz in forum Forms
    Replies: 1
    Last Post: 06-30-2014, 08:28 AM
  5. Replies: 3
    Last Post: 01-05-2012, 09:57 AM

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