Generate Account Numbers with Text

A

Arlend Floyd

How can I generate account numbers with the first 3 charters "ALS" then
numbers after?

Example: ALS3000
ALS3001
ALS3002

can this be done in the table or must it be done on the form before update?

Thanks, Arlend
 
S

Steve

Store only the account numbers as strings in your table. Base your form on a
query based on the table and add "ALS" to the accountnumber in a calculated
field in your query:
MyAccountNumber = "ALS" & AccountNumber

Steve
 
F

fredg

How can I generate account numbers with the first 3 charters "ALS" then
numbers after?

Example: ALS3000
ALS3001
ALS3002

can this be done in the table or must it be done on the form before update?

Thanks, Arlend

You cannot combine text with a number in a Number datatype field in a
table (nor is there any reason to save the "ALS" if it is always the
same text), but you can combine a number with the text in an Unbound
control, on your form in Report.

Add a field to your table.
Field name [TheNumber] Number datatype, Field Size Long Integer

In the form that you use for data entry, as the default value for this
[TheNumber] control, write
=Nz(DMax("[TheNumber]","TableName"),2999)+1

Each new record will increment from 3000, by 1, and the number will be
stored with that record in the table.
Then wherever you need to show the value with the text, on your form
or report, use an unbound control:
="ALS" & [TheNumber]
 
A

Arlend Floyd

Thanks it works

Steve said:
Store only the account numbers as strings in your table. Base your form on a
query based on the table and add "ALS" to the accountnumber in a calculated
field in your query:
MyAccountNumber = "ALS" & AccountNumber

Steve
 

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