Results 1 to 6 of 6

Is there a default setting to modify expected zero-based behavior?

  1. #1
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61

    Is there a default setting to modify expected zero-based behavior?

    Documents on MSDN report AbsolutePosition only works with dynasets or snapshots.


    I have a DAO recordset defined as
    Set rs = dbs.OpenRecordset(MySQL)
    where MySQL is a valid SELECT ... FROM ... WHERE ... ORDER BY SQL string


    (1) How do I know that rs is a dynaset or a snapshot? Here's why I ask...




    After defining rs, the following are executed
    rs.MoveLast
    rs.MoveFirst


    While on the first record in rs, I run the following...
    debug.print rs.AbsolutePosition
    ... and the value 1 is printed in the immediate window.


    (2) Could there be some setting in Access that causes AbsolutePosition to be 1-based instead of 0-based?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    6,367
    the default is dynaset
    if you want snap:
    currentdb.OpenRecordset(MySQL,dbOpenSnapshot)

    you dont need to
    rs.MoveLast
    rs.MoveFirst

    the rst always starts at first.
    the 1st record is always 1, not zero.

  3. #3
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    Very helpful, ranman. But I still have 2 questions:
    (1) How do I know that rs is a dynaset or a snapshot?
    (2) Could there be some setting in Access that causes AbsolutePosition to be 1-based instead of 0-based?

  4. #4
    yeah is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Nov 2010
    Posts
    61
    VBA arrays allow you to override their zero-based nature with Option Base 1.
    I thought there might be some other setting that modified the zero-based nature of recordset objects.
    Ideas anyone?

  5. #5
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    6,367
    i said, the default is dyna, unless you specifically as for snap.

  6. #6
    Ajax is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    5,598
    for a full range of types see this link

    https://msdn.microsoft.com/en-us/lib.../ff835080.aspx

    applies to any dao recordset, any language

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

Similar Threads

  1. Setting access runtime default find/replace behavior
    By SepieSmith in forum Programming
    Replies: 9
    Last Post: 11-05-2015, 02:53 AM
  2. Setting default
    By Thompyt in forum Programming
    Replies: 10
    Last Post: 11-10-2014, 10:49 AM
  3. Setting default vaulue?
    By djclntn in forum Forms
    Replies: 17
    Last Post: 04-12-2012, 10:20 PM
  4. Replies: 1
    Last Post: 11-16-2011, 01:29 PM
  5. Replies: 2
    Last Post: 08-05-2011, 03:41 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
  •  
Tech Forums: Microsoft Office Forums