Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting autonumber field to text 1

Status
Not open for further replies.

bowenj

Technical User
Jun 9, 2003
2
US
Good morning! I'm having a problem with auto number. I'm using the following expression to generate ID numbers "=[Prefix]+[Service Code]+[5th Modifier]+[6th Modifier]+[Serial Number]+[Suffix]+[CACID1]+[CACID2]+[CACID3]+[CACID4]+[Segment]", the Serial Number field is an auto number, the other fields are alphas. Written this way, the expression errors out, how would you convert the auto number to text?

I just found this site and checked FAQ's, but did not find any threads with this answer, sorry if it's a duplicate.
 
First of all I would recommend using ampersand(&) instead of the + sign to cancatenate the multiple values together. As far as converting the autonumber to a string just use the following:

CStr([Serial Number])

Now a consideration should be if you want a specific number of characters to be displayed for this portion of your ID number. As an example autonumber 1 will return a single digit as 1. Where autonumber of 256789 will return 5 digits. If you want to designate leading zeroes out to a set number of digits use the following. Vary the number of zeroes to the number of digits you want displayed

Format( CStr([Serial Number]), "00000000")


Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
You gave me just what I was looking for, thx very much. jjb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top