Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Printing Value in (Storage Text file)


Message #1 by "Elmer Espinosa" <elmerespinosa@y...> on Fri, 4 May 2001 00:22:40



the Input value are 1,3,5-10 in text box 



how can I extract this value to produce an output like : 

1 

3 

5 

6 

7 

8 

9 

10 



and store it in a text file ( i.e print.txt)



This Is just Like printing in a document in MS Word it will prompt you how 

many pages, where to start and where to end. 



Appreciate your help 



Thanks 

Elmer Espinosa 

 
Message #2 by Ken Clark <clarkk@w...> on Fri, 04 May 2001 13:03:26 -0700
Elmer,



If you're still stuck on this, explore creating a function that uses



"While" to loop through your input string.



Use intLocation = InStr(InputString, strLookFor) to locate the commas and 

dashes. (where strLookFor contains a "," or a "-"



Use intLength = Len(InputString) to tell you the length of the input string

Use strLeftMost = Left$(InputString, (intLength - intLocation)) to place 

the leftmost character in

a variable.



I think that strLeftMost = strLeftMost & "chr 13" (maybe it's chr 10?) will 

put in a carriage return.



If you loop through till there are no more commas, you should have 

something like



1

3

5-10



You can use InStr() and Left$ and Right$ and Len(variable) find the dash 

and seperate the 5 and the 10.



so then inside the first While statement insert

         If InStr(strLeftMost, intDash) > 0

         While -a counter variable- is < -the right most value-

         strLeftMost = strLeftMost + 1 & "chr 13"   --add 1 to the 5 and 

loop back...

         wend



This is all very cryptic and won't work the way I've written it here, but 

I've got things I actually get paid to do to get back to...



Use Access help to find the InStr, While, Left$ etc. and the MS Access 

examples should set you on your way.



Good luck!



p.s. I wrote a function that removes dashes, commas, etc.  and it 

works.  If you think looking at that would help let me know... it's about 

70 lines or so though I think I could reduce it to about 20 if I wrote it 

today, but hey, if it ain't broke...





At 5/3/01, you wrote:





>the Input value are 1,3,5-10 in text box

>

>how can I extract this value to produce an output like :

>1

>3

>5

>6

>7

>8

>9

>10

>

>and store it in a text file ( i.e print.txt)

>

>This Is just Like printing in a document in MS Word it will prompt you how

>many pages, where to start and where to end.

>

>Appreciate your help

>

>Thanks

>Elmer Espinosa

>
Message #3 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 07 May 2001 15:15:07 -0700
I would:

	Use Split() to split the input value into an array on each comma, 

	Loop thru each array element, testing for the presence of a dash

character

	If no dash, output the trimmed element

	If dash, read either side into a For Next statement and then output

each value.



HTH,



-Roy



-----Original Message-----

From: Elmer Espinosa [mailto:elmerespinosa@y...]

Sent: Thursday, May 03, 2001 5:22 PM

To: Access

Subject: [access] Printing Value in (Storage Text file)









the Input value are 1,3,5-10 in text box 



how can I extract this value to produce an output like : 

1 

3 

5 

6 

7 

8 

9 

10 



and store it in a text file ( i.e print.txt)



This Is just Like printing in a document in MS Word it will prompt you how 

many pages, where to start and where to end. 



Appreciate your help 



Thanks 

Elmer Espinosa 

 

  Return to Index