ID field increment

foxtet

Registered User.
Local time
Tomorrow, 02:41
Joined
May 21, 2011
Messages
129
Hi All
In the attached sampleDb in the frmUnit when clicked add new button I want unitID field to be increased to one.

data type of the field is text

foxtet
 

Attachments

edit your form, click on unitID textbox. on it's property, Default Value:

=CStr(Val(Nz(DMax("[UnitID]","[tblUnits]"),"0"))+1)

by the way, i would suggest changing your UnitID field in your table to numeric long. if you changed it to numeric the code is:

=Nz(DMax("[UnitID]","[tblUnits]"),0)+1
 

Users who are viewing this thread

Back
Top Bottom