formating number within text string

Davros

Registered User.
Local time
Today, 20:12
Joined
Sep 9, 2005
Messages
131
looked around but could not find the answer.
i have a text box that might or might not contain text and number data. an example of the data in the text box might be;

bob roberts, 17/03/2006, aged 23

what i would like is some VB code that would:

check anywhere in the text box for number characters that are 8 characters in length with a comma at the end [12345678,] as in the first example. and change this to 12/34/5678,

bob roberts, 17032006, aged 23
would become 'on lost focus'
bob roberts, 17/03/2006, aged 23

anybody any idea how to do this?

thanks
 
First, I would question if this is really the best way to be storing this data. I mean, someone is only going to be 23 for a year!

But, if you insist, you will need to use string functions.

InStr will search a string for a value
InStrRev will serach the string backwards
Len will tell you the lenght of a string
Asc will tell you the ASCII value of a character (so you can determine if it is a number)
Left, Right, and Mid will extract parts of a string
 
thanks for the starting point.
the data concerns dead people so it will not change. this particular information is what is taken off the headstone so that i can check that i have correctly matched up the photograph, it serves no other purpose. this data exists elsewhere in my database and is stored correctly

thanks
 

Users who are viewing this thread

Back
Top Bottom