A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

a small problem with String functions



 
 
Thread Tools Display Modes
  #1  
Old December 30th, 2007, 02:04 PM posted to microsoft.public.access.forms
Andy6
external usenet poster
 
Posts: 31
Default a small problem with String functions

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.
  #2  
Old December 30th, 2007, 02:49 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default a small problem with String functions

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
http://www.accessmonster.com/Uwe/For...forms/200712/1

  #3  
Old December 30th, 2007, 03:08 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default a small problem with String functions

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

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

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

  #4  
Old December 30th, 2007, 05:42 PM posted to microsoft.public.access.forms
Andy6
external usenet poster
 
Posts: 31
Default a small problem with String functions

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

"Linq Adams via AccessMonster.com" wrote:

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

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

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com


  #5  
Old December 30th, 2007, 06:20 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default a small problem with String functions

Glad you got it working!

Happy New Year to you and yours!

Linq.

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

Answers/posts based on Access 2000/2003

Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.