Results 1 to 4 of 4
  1. #1
    rivereridanus is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    71

    get current record

    Hi,



    I am having trouble getting the ID of the current record displayed on a form. The code I have written is this:
    Code:
    Dim ProjID As Long
    ProjID = Forms![ProjectDetailsAll].CurrentRecord
    The problem is that this code returns the record number relative to other records (so, this record is number 2634 of 2634). However, I am trying to get the ID of the record, which is an autonumber and is not the same as the record's order amongst other records. There have been record deletions ahead of this record, so the ID might be 3096 even though CurrentRecord tells me that this record is number 2634. Is there another way of writing this to get what I need?

  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
    ProjID = Forms![ProjectDetailsAll]!IDFieldName

    where IDFieldName is the name of the field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rivereridanus is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    71
    Thanks, that helps a lot!

  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
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Retaining current record.
    By mnsemple83 in forum Forms
    Replies: 10
    Last Post: 08-30-2011, 08:58 AM
  2. No current record.
    By harmankardon in forum Programming
    Replies: 5
    Last Post: 08-11-2011, 05:48 AM
  3. Remain on Current Record
    By billgyrotech in forum Forms
    Replies: 17
    Last Post: 08-08-2011, 12:15 PM
  4. Report from current record
    By billgyrotech in forum Reports
    Replies: 18
    Last Post: 07-26-2011, 03:39 PM
  5. copy current record to new record
    By er_manojbisht in forum Forms
    Replies: 1
    Last Post: 02-27-2010, 05:31 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