Results 1 to 4 of 4
  1. #1
    sergi117 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2018
    Posts
    30

    Public function for lag and lead?


    SQL server has this amazing set of functions (lag and lead). Unfortunately it is not available in Microsoft access, but I was wondering if anyone knows or has written a vba public function equivalent for lag and lead. The potential of lag and/or lead are so amazing that it actually surprised me that Microsoft access doesn't have it. Thank you for your time!

  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,518
    I've seen it done with a subquery:

    http://allenbrowne.com/subquery-01.html#AnotherRecord
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Well (probably because i'm stuck on SQL server 2008!) I didn't know about those functions. Neat.
    Still learn something new every day.
    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 ↓↓

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Quote Originally Posted by Minty View Post

    Still learn something new every day.
    That's what makes Access so much fun...and why I'm still playing with it, 12 years after they put me out to pasture!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. public function values from form
    By ShostyFan in forum Programming
    Replies: 4
    Last Post: 10-02-2017, 02:11 PM
  2. Public Function
    By ShostyFan in forum Programming
    Replies: 3
    Last Post: 09-30-2017, 09:58 AM
  3. VBA Can't find Public Function
    By GraeagleBill in forum Programming
    Replies: 15
    Last Post: 03-17-2016, 09:38 PM
  4. Pass DAO.Recordset into public function
    By Ruegen in forum Programming
    Replies: 1
    Last Post: 07-07-2014, 12:31 AM
  5. Turning Private Function Into Public
    By g4tv4life in forum Programming
    Replies: 1
    Last Post: 02-04-2014, 05:31 PM

Tags for this Thread

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