How to find out if I'm standing on a new record row in a form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Michael R
    New Member
    • Nov 2006
    • 176

    #1

    How to find out if I'm standing on a new record row in a form?

    Hi everyone.

    For a coding of something which seem too long to explain, I need to find out, by .recordset or any other way, whether or not I (the user) am standing on the new record row in a form.

    I've checked .EOF, but it gives me 'False'. I also have checked .AbsolutePositi on but it gives me the record number of the last record I was standing on.

    Maybe there's some other way, or other property of .recordset I'm not aware about that can distinct the new record row?

    Thanks a lot,
    Michael.
  • DonRayner
    Recognized Expert Contributor
    • Sep 2008
    • 489

    #2
    You could catch the "me.recordset.r ecordcount" value into a form global variable in the forms "On Open" event. Then check your variable against the the current "me.recordset.r ecordcout" value in the forms "On Current" event.

    Personally I would make it impossible for a user to get to a new record unless it was through a control that I placed on the form.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      1. If you are at a New Record on a Form, then the Me.NewRecord Statement will evaluate to True in the Form's Current() Event.
      2. After you invoke the AddNew() Method on a Recordset, the AbsolutePositio n Property of the Recordset will evaluate to -1.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Me.NewRecord is the simple answer.

        It's hard to find (I keep losing it and struggling to find it again), as it's relative to Me rather than relative to the more intuitive Me.Recordset.

        Comment

        • Michael R
          New Member
          • Nov 2006
          • 176

          #5
          Thanks so much, Me.NewRecord works great!

          Comment

          Working...