Extracting a text field into 2 numeric ones

  • Thread starter Thread starter Mr.D
  • Start date Start date
M

Mr.D

Guest
I have a database with a field holding odds for horses in races. It is a text field, with entries such as '100-1' and '5-2'. I need to take the number before the dash and put it in a new field, and take the number after and put it in another. Also there are occurances of 'evs' for evens 1-1, I will have to extract two 1's for that. Any ideas how this can be coded in VB I would be very grateful.
 
hi Mr.D.,

you could use instr(1,chr(45),MyField) and nest this into a Mid, Left right or whatever. Then have an Update query that will stick the two parts into 2 fields. For example

Left(MyField, (InStr(1, MyField, Chr(45))) - 1) etc

regards

Drew
 

Users who are viewing this thread

Back
Top Bottom