Identify the current record number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Becker
    New Member
    • Jul 2012
    • 54

    Identify the current record number

    I want my database to open automatically to the last record that was being viewed on a form when it was closed. I was thinking of having the current record number saved to a textbox in a table so that the number could be recalled and I could use the gotorecord command to go there. I don't know how to have access determine and save the current record number to a text box though. Any ideas on how to do this would be lovely. Thanks.
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    Use the OnCurrent Event of your form and save the record number to a table, just be sure to use a unique record identifier.

    Comment

    • Becker
      New Member
      • Jul 2012
      • 54

      #3
      Thanks. Also I just found out I can refer to the record as me.currentrecor d. I didn't think it would be that easy.

      Comment

      • jforbes
        Recognized Expert Top Contributor
        • Aug 2014
        • 1107

        #4
        You might want to check out: http://allenbrowne.com/ser-18.html

        Comment

        • Becker
          New Member
          • Jul 2012
          • 54

          #5
          Have you used the code on that site before? I think it looks like exactly what I want to do.

          I created the table and pasted the code in but it doesn't work. It says that the field me.customerid could not be found (in the unload event). Is there something else I was supposed to do to make this code work?

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32661

            #6
            If you use code that's been posted then you have to make sure that any field names referred to match the fields you have available. Any other references would have to follow the same basic approach. You cannot generally expect code written to refer to specific items to work in your own system directly unless you know that all references in the original match your own setup that precisely.

            Comment

            Working...