I have a table and a form in my database. On my form, I have used the
command button [Add New Record] and it lets me enter my information. I would
like for my ListSeg Field in my table to update every time a new record is
added.
The ListSegs are 4 characters 0001, 0002, 0003, etc and are stored as text.
How do I get it to autogenerate to the next ListSeg when adding a new record.
I don't want for the user to have to type in the List Seg, but for it to
already be there.
Any suggestions would be appreciated
Make this the Default Value of the control on your form where you want the
ListSeg to be incremented. ListSegTable is a made up name because I don't
know the name of your table, use your own table name here.
=Nz(DMax("[ListSeg]", "ListSegTable"),0) + 1
> I have a table and a form in my database. On my form, I have used the
> command button [Add New Record] and it lets me enter my information. I would
[quoted text clipped - 7 lines]
>
> Any suggestions would be appreciated
Mjohnson - 25 Jan 2006 15:12 GMT
Thanks! That worked great. The only thing that I still need to do is format
the LIstSeg so there is a "0" in front of the newly generated number. Is
there a way I can force the 0 to appear?
> Make this the Default Value of the control on your form where you want the
> ListSeg to be incremented. ListSegTable is a made up name because I don't
[quoted text clipped - 13 lines]
> >
> > Any suggestions would be appreciated
Klatuu - 25 Jan 2006 15:19 GMT
=Format(Nz(DMax("[ListSeg]", "ListSegTable"),0) + 1, "000")
> Thanks! That worked great. The only thing that I still need to do is format
> the LIstSeg so there is a "0" in front of the newly generated number. Is
[quoted text clipped - 17 lines]
> > >
> > > Any suggestions would be appreciated