Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: String Manipulation ACCESS


Message #1 by "Elmer Espinosa" <elmerespinosa@y...> on Thu, 3 May 2001 19:41:51
Any help would be appreciated.  



I have a List of record in a table such as 



dun0424a.prt

da0129a2.gr1

da0130a4



I want to rename this record and save it in next field for example 



dun0424a.txt

da0129a2.txt

and if the record is "da0130a4" I want to output is "da0130a4.txt"



to visualize it 



Record              



dun0424a.prt  =   dun0424a.txt

da0129a2.gr1  =   da0129a2.txt

da0130a4      =   da0130a4.txt



thanks 

Elmer























Message #2 by Ken Clark <clarkk@w...> on Thu, 03 May 2001 12:33:44 -0700
I think I'd do something like:



strLeft = Left$(strInput, 8)

strInput = strLeft & ".txt"





This assumes that all items left of the "." are 8 char. long....





At 5/3/01, you wrote:

>Any help would be appreciated.

>

>I have a List of record in a table such as

>

>dun0424a.prt

>da0129a2.gr1

>da0130a4

>

>I want to rename this record and save it in next field for example

>

>dun0424a.txt

>da0129a2.txt

>and if the record is "da0130a4" I want to output is "da0130a4.txt"

>

>to visualize it

>

>Record

>

>dun0424a.prt  =   dun0424a.txt

>da0129a2.gr1  =   da0129a2.txt

>da0130a4      =   da0130a4.txt

>

>thanks

>Elmer

>

>

>

>
Message #3 by "Donald Carroll" <dcarroll@f...> on Thu, 3 May 2001 21:33:48
I would do something like:



Declare a variable called intSpacePosition or something and use the InStr 

function to find out what position the period is in and then subtract that 

the variable intSpacePosition minus 1 and you will know how many 

characters there are before the extension.



Example:



Dim intSpacePosition As Integer

Dim strInput As String

Dim strLeft As String

Dim strNewField As String



? If there are 8 characters before period, the IntSpacePosition variable 

will have the value 9



intSpacePosition = InStr(strInput, ?.?)

 

strLeft = Left$(strInput, IntSpacePosition ? 1)

strNewField = strLeft & ?.txt?


  Return to Index