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!

Adding a number to a string field

Status
Not open for further replies.

Syerston

Programmer
Jun 2, 2001
142
GB
I have a reference number which takes the form 40184567_00.
Before the record is saved a recordset is created to check if another user has added the reference. If this is the case the last two digits are to be increased by the recordcount.

Is there a way to do this? The problem obviously is the "_".

P.s I've tried int(txtRef) but to no avail.
John
 


Hi Syerston

First, Int or even Long are too small for your rather long code. Think CDbl should cover your needs.

Then just create two functions - one that accepts a string and coverts it to a number - another to accept a number and add one then convert to your style string.

Use wherever you want.

Stew

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top