Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if on new record?

Status
Not open for further replies.

Hakala

Technical User
Apr 26, 2006
144
US
I'm working with Access 2002 and have an autonumber field as my Primary Key. When my form opens, this field says (AutoNumber) and code can't determine if the field has a null value. How can I use code to tell me whether I'm on a new record (before updating anything) or not?

I've tried to find the FAQs on this site to browse them (search wasn't helpful with "new record" as my keyword; too broad) but couldn't. Is it possible to find the FAQs without a specific search?

Thanks!
 
Hakala,
Code:
If Me.Recordset.BOF or Me.Recordset.EOF Then
   'I am on a new record
End If

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Not sure on this one, but I would guess that you should lookup the BOF or EOF topic in Microsoft Access Help. Hope this will get you in the right direction.

Tom

Live once die twice; live twice die once.
 
How about...
Code:
If [COLOR=blue]Me.NewRecord[/color] Then
HTH,

Ken S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top