How to tell if I'm adding a new record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to be able to test to see if a user is currently attempting to add a
new record using the Access navigation buttons. Once the user starts entering
data, the little "edit pencil" shows up on the upper left of the form. At one
point, I want to be able to determine if they're editing an existing record,
or are in the process of adding a new one. How can I do that in VBA please?
(Access 2002)

Thanks!
 
Check the NewRecord property of the form ...

If Me.NewRecord Then
'we're at the new record
Else
'we're not
End If
 
Dennis said:
I need to be able to test to see if a user is currently attempting to add a
new record using the Access navigation buttons. Once the user starts entering
data, the little "edit pencil" shows up on the upper left of the form. At one
point, I want to be able to determine if they're editing an existing record,
or are in the process of adding a new one. How can I do that in VBA please?
(Access 2002)


You can use the form's NewRecord property to check if it's a
new record. The value of the NewRecord property will be
True if the record is new or False for existing records.

The form's Dirty property reflects what the pencil
indicates.
 
check to see what value is in the Primary Key field. before the record is
inserted it will probably be null, it won't be if the record is already
there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top