Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have answered some questions and have gotten answers for my questions. Anywhere you can do this on one page helps tremendously..."

Geography

Where in the world do Tek-Tips members come from?
Lhuffst (Programmer)
16 Apr 12 16:03
Hi
I have a text box that has 2 separate lines.
Service Area:  xxxxxx
Health Dept:  xxxxx

Users want to switch order to

Health Dept: xxxx
Service Area: xxxx

Since each line can have different lenghts, what is the easiest way to do this? Thanks lhuffst
SkipVought (Programmer)
16 Apr 12 16:07


uh, HOW is this textbox loaded?

and WHY is a TextBox being used like this?  a TextBox is designed to be a control for user input???

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Lhuffst (Programmer)
16 Apr 12 16:09
We converted an old system to a new cots program and this is how old data was initially requested to be loaded.  In the future they will have to do the input themselves but since we converted 300,000+ records, I wanted to see if we could make the initial flip.

As to how the vendor loaded it, I can't answer, I just know that is what I see when I look at the table.  Any ideas on how this could be done?
Helpful Member!  SkipVought (Programmer)
16 Apr 12 16:16


CODE

dim a

a = split(YourTextBox.Text, vblf)

YourTextBox.Text = a(1) & vblf & a(0)
assuming that a LineFeed separates the two lines.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Helpful Member!  dhookom (Programmer)
16 Apr 12 16:26
Don't you want to change the values stored in a field in your table? Are you hoping to swap anything before a carriage return/line feed with anything after it?

Duane
Hook'D on Access
MS Access MVP

Lhuffst (Programmer)
16 Apr 12 16:35
Hi yes I do want to update the table swapping the text before and after the carriage return.

Is it easier to do in a query?
 
SkipVought (Programmer)
16 Apr 12 16:38


That's why I was asking HOW the text box is loaded???

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Lhuffst (Programmer)
16 Apr 12 16:45
SkipVought - I apologize.  I was not the one who loaded the textbox so I have no idea how they did it.  For me, I just want to flip the data the easiest way possible.  

What I just did was to export the table to a blank database so I can do trial and error since this is a production system.  That way I can't mess anything up :)
dhookom (Programmer)
16 Apr 12 17:02
I like Skip's use of Split() but had an issue getting it to work in a query. Consider the following query to display the conversion. Change this select query to an update query to store the actual changes. I would work with a test table first.

CODE

SELECT NoTableName.FieldNoNameGiven,
 Mid([FieldNoNameGiven],InStr([FieldNoNameGiven], Chr(13)+Chr(10))+2) &
Chr(13) & Chr(10) &
Left([FieldNoNameGiven],InStr([FieldNoNameGiven], Chr(13)+Chr(10))-2) AS NewValue
FROM NoTableName
WHERE (((NoTableName.FieldNoNameGiven) Like "*" & Chr(13) & Chr(10) & "*"));

Duane
Hook'D on Access
MS Access MVP

SkipVought (Programmer)
16 Apr 12 20:49

@Duane,

There was nothing in the question, explicit or implicit, regarding SQL, forum not withstanding.

The OP appears NOT to have access to the Access source code.

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

Lhuffst (Programmer)
18 Apr 12 9:02
Duane, that worked perfectly. Thanks

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close