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

Add letter to incrementing number? 1

Status
Not open for further replies.

needadvice

Programmer
Apr 7, 2002
145
US
I have the following code that increments to the next number each time a form is opened:

X = DMax("[REF#]", "OrderTBL")
X = X + 1
Me.[Ref#] = X


Is there any way to add the prefix "E" to the number so it come out like E1,E2 etc.. I concatenated it but that only worked once, then the next number would not generate. I finally just made it two seperate fields but am curious to know if there is a way.
Thanks for any help.
 


Hi,
Code:
X = DMax("[REF#]", "OrderTBL")
X = X + 1
Me.[Ref#] = "E" & X


Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Me.[Ref#] = "E" & (1 + Val(Mid(Nz(DMax("[REF#]", "OrderTBL", "[REF#] Like 'E#*'"), "E0"), 2)))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top