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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record is new 1

Status
Not open for further replies.

SQLScholar

Programmer
Aug 21, 2002
2,127
GB
Hey all,

Bit of an access newbie (used to VB6 and SQL)

If there is a form with a control box at the bottom, is there any easy way to tell if the record you on is a new record or an old one?

Dan

----------------------------------------
There are 2 types of computer, the prototype and the obsolete!!
----------------------------------------
 
Have a look at the NewRecord property of a bound Form.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok - getting abit confused when i can do this.

There seems to be no change of record property? Is there anyway i can run code when the record number changes?

Thanks

----------------------------------------
There are 2 types of computer, the prototype and the obsolete!!
----------------------------------------
 
I guess you want to look at the Current event of the Form object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ah - wait a sec. I have it nearly working.

i have

Code:
Private Sub Affiliate_Code_GotFocus()
If Form.NewRecord = 0 Then
    Form_Affiliates.Affiliate_Code.Locked = True
Else
    Form_Affiliates.Affiliate_Code.Locked = False
End If
End Sub

In the got focus of the text box.

So this works, other then if you go into the box, change the value - then go into another box. Then go back, and its locked (for some reason newrecord = -1)??

Abit confused, as surely this is still a new record?

Dan

----------------------------------------
There are 2 types of computer, the prototype and the obsolete!!
----------------------------------------
 
AHA - no idea why, but its now working ok. I must have got the thing a tad confused working on the fly.

Thanks

Dan

----------------------------------------
There are 2 types of computer, the prototype and the obsolete!!
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top