text and increment numbers

G

Guest

thank you in advance for your help.

i need to created a field for text +increment numbers as a record number.

example would be "R000001"

the text "R" would be fixed and not from any other field, i just need to
have the numbers in increment for every new record.
 
R

Rick Brandt

JLee said:
thank you in advance for your help.

i need to created a field for text +increment numbers as a record
number.

example would be "R000001"

the text "R" would be fixed and not from any other field, i just need
to have the numbers in increment for every new record.

If the "R" never changes then it doesn't need to be stored and neither do
the leading zeros. Just have an ID field of type LongInteger and in the
BeforeUpdate event of your form have code...

If Me.NewRecord Then
Me!ID = Nz(DMax("ID", "TableName"), 0) + 1
End If

On your forms and reports you can *display* this ID with a format property
of...

\R000000
 
S

Steve Schapel

JLee,

If the "R" is fixed, then there is no need to include it in the data
that is stored in the table. It can easily be included, via a query, or
via the Format property of the control, whenever you need it to *appear*
with the required structure, on your forms or reports. If I understand
you correctly, I would recommend using a Number data type field, and
just storing the incrementing number itself. In this case, an
AutoNumber data type field may be applicable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top