Results 1 to 9 of 9
  1. #1
    Bond77 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    3

    Continuous Form Using VBA to set top record

    I have been struggling with this one for a few days now, and am hoping the experts here can help. If this is answered somewhere else in the forums I apologize.



    I have a continuous form that I want to scroll automatically by using the on timer event. I have tried using the seltop property and it works perfectly when I jump to two records below the last visible record; however, when I jump to the 1st record that is not visible it only scrolls down one record (making that the last record visible instead of the 1st record visible. Below is an example of the problem I am having:

    Record 1
    Record 2
    Record 3 (Last visible Record at the bottom of the form)
    Record 4
    Record 5
    Record 6
    Record 7

    If I use seltop to jump to record 4 the form shows records 2 through 4; but if I set seltop to jump to record 5 the form shows records 5 through 7. I would like to have the form show record 4 as the first visible record.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Perhaps you will find this link useful: http://www.lebans.com/setgetsb.htm

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I did a quick test of this, and here is what I found.

    If the record you want to see at the top of the display is already visible, but is not the top one, then selTop does not work. If the record you want is above or below the visible area, then selTop does work.

    Not thoroughly tested, but that seems to be the answer.

  4. #4
    Bond77 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    3
    I tried to look at the Lebans code, but I cannot open the sample db because of the version of access it was created in.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Ahh...it was done in ac97. I converted it to 2000 file format w/ ac 2002. see if you can open it.
    Attached Files Attached Files

  6. #6
    Bond77 is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    3
    Quote Originally Posted by RuralGuy View Post
    Ahh...it was done in ac97. I converted it to 2000 file format w/ ac 2002. see if you can open it.
    Thank you, that version worked.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Outstanding!!! Thanks for the feedback and marking the thread as Solved.

  8. #8
    axsus3r is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2018
    Posts
    2
    Hi,

    I unfortunately cannot open the 'GetSetBarsv7.zip' file you provided.

    I have Access 2013 (64 bits) and i'm always getting the annnoying error 'Cannot open a database created with a previous version of your application' when
    trying to open it.

    Any help appreciated.

    Quote Originally Posted by RuralGuy View Post
    Ahh...it was done in ac97. I converted it to 2000 file format w/ ac 2002. see if you can open it.

  9. #9
    axsus3r is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2018
    Posts
    2
    Ok, i finally found a workaround by importing all the db objects in a fresh new .accdb file.

    I still don't get why my Access install didn't want to open the file directly though.

    I would have share my created file if i could, but i think this ability is reserved for administrators.

    Thanx anyway for leading me to the solution anyhow ^^


    Oh and while i'm here, i think it's worth mentioning that in order to properly work in access 2007/2010/2013 the following statement in fIsScrollBar function :


    Code:
    If fGetClassName(hWnd_VSB) = "scrollBar" Then
    has to be replaced with :

    Code:
    If fGetClassName(hWnd_VSB) = "NUIscrollBar" Then
    I got this info from another forum.

    (Note that you might also need to update this statement in the function fIsScrollBarHZ)


    Cheers !


    Quote Originally Posted by axsus3r View Post
    Hi,

    I unfortunately cannot open the 'GetSetBarsv7.zip' file you provided.

    I have Access 2013 (64 bits) and i'm always getting the annnoying error 'Cannot open a database created with a previous version of your application' when
    trying to open it.

    Any help appreciated.
    Last edited by axsus3r; 02-26-2018 at 07:24 AM.

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

Similar Threads

  1. Moving to record on a continuous sub-form
    By tonez90 in forum Access
    Replies: 4
    Last Post: 09-11-2017, 04:46 PM
  2. Continuous Form blank record
    By QuantifyRisk in forum Forms
    Replies: 3
    Last Post: 12-01-2014, 09:07 AM
  3. More than One Record on filtered Continuous Form
    By Williams485 in forum Forms
    Replies: 3
    Last Post: 03-13-2013, 04:56 AM
  4. Delete continuous form record
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 03-09-2012, 03:00 PM
  5. Get position of record in continuous form
    By Whizbang in forum Forms
    Replies: 3
    Last Post: 11-02-2011, 01:47 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