473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Text convert Code please

Hi I have data resembling like this
Clearing, The
Italian Job, The
Final Cut, The
Manson Family, The
I would like some code to convert the data to

The Clearing
The Italian Job
The Final Cut
The Manson Family
Can Someone please help me??
Regards
Graham
Nov 13 '05 #1
2 1670
Assuming the text to be transformed is stored in OriginalText, something
like the following will transform it as desired:

Trim(Mid(OriginalText, InStr(OriginalText, ",") + 1)) & " " &
Left(OriginalText, InStr(OriginalText, ",") - 1)

Of course, that'll fail if there isn't a comma in the text, but
unfortunately, due to how the IIf function works, you can't simply use:

IIf(InStr(OriginalText, ",") = 0, OriginalText, Trim(Mid(OriginalText,
InStr(OriginalText, ",") + 1)) & " " & Left(OriginalText,
InStr(OriginalText, ",") - 1))

you'll have to write a function like:

Function FixText(OriginalText As String) As String

If InStr(OriginalText, ",") = 0 Then
FixText = OriginalText
Else
FixText = Trim(Mid(OriginalText, InStr(OriginalText, ",") + 1)) & " "
& Left(OriginalText, InStr(OriginalText, ",") - 1)
End If

End Function

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Graham Feeley" <gr***********@optusnet.com.au> wrote in message
news:42***********************@news.optusnet.com.a u...
Hi I have data resembling like this
Clearing, The
Italian Job, The
Final Cut, The
Manson Family, The
I would like some code to convert the data to

The Clearing
The Italian Job
The Final Cut
The Manson Family
Can Someone please help me??
Regards
Graham

Nov 13 '05 #2
Thanks Douglas for a very instant reply, I am off to work now will try it
tomorrow evening, will let u know.
Really appreciate the help and time you guys out in here
Regards
Graham

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:Tp********************@rogers.com...
Assuming the text to be transformed is stored in OriginalText, something
like the following will transform it as desired:

Trim(Mid(OriginalText, InStr(OriginalText, ",") + 1)) & " " &
Left(OriginalText, InStr(OriginalText, ",") - 1)

Of course, that'll fail if there isn't a comma in the text, but
unfortunately, due to how the IIf function works, you can't simply use:

IIf(InStr(OriginalText, ",") = 0, OriginalText, Trim(Mid(OriginalText,
InStr(OriginalText, ",") + 1)) & " " & Left(OriginalText,
InStr(OriginalText, ",") - 1))

you'll have to write a function like:

Function FixText(OriginalText As String) As String

If InStr(OriginalText, ",") = 0 Then
FixText = OriginalText
Else
FixText = Trim(Mid(OriginalText, InStr(OriginalText, ",") + 1)) & " " & Left(OriginalText, InStr(OriginalText, ",") - 1)
End If

End Function

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Graham Feeley" <gr***********@optusnet.com.au> wrote in message
news:42***********************@news.optusnet.com.a u...
Hi I have data resembling like this
Clearing, The
Italian Job, The
Final Cut, The
Manson Family, The
I would like some code to convert the data to

The Clearing
The Italian Job
The Final Cut
The Manson Family
Can Someone please help me??
Regards
Graham


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: kittykat | last post by:
Hi, could someone please check my code? its asking the user to enter 3 letters, and check to see if these letters exist in the text file. i know ive done something wrong. can someone fix my code...
4
by: anatushi | last post by:
Hi, im looking for help on how to add a text fader to my website, usually i'm working with css but in this case i need to add java script to make it work, that wasn't the problem but somehow it...
7
by: Eddy Soeparmin | last post by:
Hi, I need to display a DateTime field in 'mm/dd/yyyy' in a DataGrid.. On myGrid1 - Properties - Columns - myColumn1 - Text format string: I tried to put 'mm/dd/yyyy' in there and it displays...
6
by: Lelle | last post by:
Hello ! how can i insert text containg code examples from a textbox into a database using SQL insert statment. i have no problem to just add text that dont contains code and script examples...
4
by: Trint Smith | last post by:
How can I improve this code please? It sometimes produces this error: "Object reference not set to an instance of an object" When I do this: strSQL = "UPDATE TBL_Items SET" & _ " item_itemnumber...
9
by: H. Dederichs | last post by:
Hello NG, I would like to read and write Outlook PST-Files with my VB.NET application natively. Is there anyone who can help me with this issue? Since PST-Files are "also" Databases, aren't...
0
by: NatMU1 | last post by:
I am coding a lexer that reads the input from a text file and displays the token ID's of each of the words in the file (e.g. if the file contains "<HEAD>" it displays the Symbol ID 10). Below is...
2
by: Ecot | last post by:
Hi all, I have not got any php knowledge and I have found a php code on the net and using it to send e-mail from a web html form.So far the form and the code works fine. I have the following php...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.