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

Clarification of incrementing a numberic portion of a string

Status
Not open for further replies.

pewilson

Technical User
Mar 9, 2001
52
US
I really want to create a primary key similar to D-1001where part is "text" and the other part is "numberic", but I found an sample code that will give the results that I am after. But I do not fully understand what's going on here.

Private SomeField_AfterUpdate()
Dim StrMax as String
strMax=DMax("FOO","FOOTable")
me!HiddenFooCrl = "REC-" &
right(strMax,_
len(strMax)-_
Instr(1,strMax,"-"))+1
End Sub


1. Can someone tell how the process works?
2. Is there another method to use that may have more clarity than this?

I appreciate any all the help I can get in trying to comprehend this process.

 
Open the table with the ID you want to change in Design View, and click on the ID field. Type "REC-"& in the Format area. Your data will now display (and note that display only - because if you use VB to access the data it's still a number only) - as you want it. Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top