Question Locked

How to extract numbers from the middle of a string of numbers ?

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a string of 19 digits but when I enter the 19 digits into a form in access I want the field to display only the 9 digits located in the middle of the string which means that the nine digits are bound by 7 digits on the left and 2 digits on the right.
I think I need a VB code in order to make this work.
Any help will be appreciated.

3 replies

by trsbrn

One solution is to write a routine to parse the string and convert it to an array of integers.

I don't know of any inbuilt functions that will do that for you.

by slayer_

[pre]
Dim sTemp as string
sTemp=mid(InputString,7,9)
[/pre]
InputString is your 19 digit code, stemp will get the 9 digits you want

Mid statement is like this
mid(String to read,starting character, [length]) as string
Length is optional, if you omit length, the remainder of the string is used.

In .net, I believe the command is StringVariable.SubString

This discussion is closed to new replies.