JohanF,
That is what i am trying to do..but how do i use the replace function in my code? can you please give me an example as ive only been using vba for a month and im lost to be honest!
thanks for the reply tho!
Main Topics
Browse All TopicsHi Experts,
Im trying to manipulate a file in access 2003 using vba. i have a .txt file that contains strings such as
OLD=1+5050854479878++:0074
ok, firstly i set the fso and textstream to get the file into a text box on a form in access.. this i can do. i also set it to read the file line by line using readline.
my problems start when i try to manipulate the strings.. how do i do it? i know i must use inSTR, Left, Right etc but how do i use them?
as an example im trying to get the above line of code to:
OLD 1 5050854479878 007415144 8 12
i have attached the code i have used so far but i know there is a better way as the strings are not always equal length etc
i have also attached the ,txt order file im using
thanks hugely in advance!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This simply replaces the charactor and returns a string. see the example below
'define a string and store the values from string into that
dim tempstr as string
tempstr = txtstr.ReadLine
tempstr = Replace(tempstr ,"+"," ")'replace + with a space
tempstr = Replace(tempstr ,":"," ")'replace : with a space
tempstr = Replace(tempstr ,"="," ")'replace = with a space
tempstr = Replace(tempstr, "'", " ") 'replace ' with a space
tempstr = Replace(tempstr ," "," ") ' double spaces replaced by single space
tempstr = Replace(tempstr ," "," ")' double spaces replaced by single space
tempstr = Replace(tempstr ," "," ")' double spaces replaced by single space
tempstr = Replace(tempstr ," "," ")' double spaces replaced by single space
MsgBox tempstr
by this time the tempstr variable should have OLD 1 5050854479878 007415144 8 12, I put a msgbox to verify as well
Hope this works!
Yohan
Business Accounts
Answer for Membership
by: YohanFPosted on 2009-09-17 at 03:55:39ID: 25354611
It seems like what you want to do is remove this charactors and replace them with spaces. What dont you use a replace and eliminate charactors 1 by 1.
Such as
txtline = Replace(txtline,"+"," ")
txtline = Replace(txtline,":"," ")
After that I would search for double spaces and replace them with 1 to remove extra white space (do this about 3 times and you wil be sorted.
txtline = Replace(txtline," "," ")
txtline = Replace(txtline," "," ")
txtline = Replace(txtline," "," ")
Let me know if i got the wrong end of the stick..
cheers
Yohan