A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Generate Account Numbers with Text



 
 
Thread Tools Display Modes
  #1  
Old December 12th, 2008, 08:24 PM posted to microsoft.public.access.tablesdbdesign
Arlend Floyd
external usenet poster
 
Posts: 22
Default Generate Account Numbers with Text

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


  #2  
Old December 12th, 2008, 09:25 PM posted to microsoft.public.access.tablesdbdesign
Steve[_57_]
external usenet poster
 
Posts: 598
Default Generate Account Numbers with Text

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



"Arlend Floyd" wrote in message
...
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




  #3  
Old December 12th, 2008, 09:40 PM posted to microsoft.public.access.tablesdbdesign
fredg
external usenet poster
 
Posts: 4,386
Default Generate Account Numbers with Text

On Fri, 12 Dec 2008 12:24:10 -0800, Arlend Floyd wrote:

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]


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #4  
Old December 15th, 2008, 02:06 AM posted to microsoft.public.access.tablesdbdesign
Arlend Floyd
external usenet poster
 
Posts: 22
Default Generate Account Numbers with Text

Thanks it works

"Steve" wrote:

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



"Arlend Floyd" wrote in message
...
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





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.