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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prefix Autonumber with characters from another field

Status
Not open for further replies.

Fireman1143

IS-IT--Management
Mar 5, 2002
51
US
I need to refix the autonumber feild with the first three characters from the Last Name field in the same table. Obviously it needs to change the autonumber AFTER the Last Name is entered into the record, not when the record opens.

Any ideas would be appreciated.
 
You won't be able to do this to the autonumber directly as the data type is long integer. But, there is more than one way to skin a cat and we need to fully understand your goal before making recommendations. Exactly how is this new number to be used? Are we talking about an existing DB with several records or are you starting from scratch?

"Retired Programmer", that is. So, please be patient.
 
Add another column to your table, e.g. "GUID".
Do you use a form to enter data?
If so, you could bind a text field to this column, add a "Save" button, and in its click event:
Code:
Sub Savebtn_Click()
Me!Guid=Left(Me!LastName,3) & Me!ID

Or the like...

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
[2thumbsup]
Thanks to both of you. Your input made it easier to figure how I wanted to format and get this.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top