How to tell if I'm adding a new record

D

Dennis

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!
 
B

Brendan Reynolds

Check the NewRecord property of the form ...

If Me.NewRecord Then
'we're at the new record
Else
'we're not
End If
 
M

Marshall Barton

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.
 
S

SJ

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.
 
Top