a small problem with String functions

A

Andy6

I am dealing with strings that contain text such as 'Box1,1' to 'Box30,14'
and I need to seperate out the numbers either side of the comma (,).
Can anyone help with string functions or code to do this and store the
numbers in integer variables.
Many thanks in advance. Andy.
 
L

Linq Adams via AccessMonster.com

Two questions:

Do all the strings have Box, the comma and two "numbers?"

What version of Access are you running?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
L

Linq Adams via AccessMonster.com

If the answer to my last question is Yes, and if you're running Access 2000
or later, xomething like this will do it:

Dim OriginalString, StrippedString As String

StrippedString = Replace(OriginalString, "box", "")
Me.FirstNumber = Left(StrippedString, InStr(StrippedString, ",") - 1)
Me.SecondNumber = Right(StrippedString, Len(StrippedString) - (InStr
(StrippedString, ",")))

Linq
 
A

Andy6

Linq.
Many many thanks. your solution gave me all the components I needed to get
my head around my problem.
regards, Andy.
 
L

Linq Adams via AccessMonster.com

Glad you got it working!

Happy New Year to you and yours!

Linq.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top