I am using VBA, how do you test for new record in a form

  • Thread starter Thread starter Umar
  • Start date Start date
U

Umar

What should I test my VBA code so that I know the User is working with record
as New in a Form. I am using Access 2007 under Windows XP.

I used PrimaryID as an auto generated number, therefore it is Null in the
begining that is how I know the user is trying to add a new record and not
editing an existing one.

So I test for IsNull(PrimaryID) which works if the user do not make mistake
but as the user enter more information made mistakes and need to correct the
PrimaryID is no longer Null. So my test passed as if the use is editing the
existing record when in fact the user is trying to add a new record.

Any help is appreciated.
 
Simply use Me.NewRecord if it is true then it is a new record, regardless how
many times the user has re-enter the information.
 
Back
Top