Solved

visual basic editting a line from database

Posted on 2004-04-16
2
235 Views
Last Modified: 2013-12-04
I have a record like this


This is a great one                       03245445Might even go home              545455


this is one record that looks exactly like the real thing

the first bit is 19 char long = This is a great one  
2nd is 9 = 03245445
3rd is 19 = Might even go home
4th is 6 = 545455


what i need to do is final result

This is a great one:idtnum-03245445:
new record:
STATEMENTS-ID-Might even go home:zip-545455

now i was think of first breaking each part up and storing the value to a variable then doing a replace for additional info and then making a variable that pieces it all together. Is that the best solution.
ex.

firstpart = left$(record.fields, 9)
etc.

the char lengths will always be the same the words will not except for the ones that I am manually adding.

this is in visual basic 6.
0
Comment
Question by:peanut1010
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Expert Comment

by:JohnK813
ID: 10844425
"now i was think of first breaking each part up and storing the value to a variable then doing a replace for additional info and then making a variable that pieces it all together. Is that the best solution."

That's probably the way I'd approach this.  Was this a question of opinion or do you need help on this?
0
 
LVL 3

Accepted Solution

by:
Phoenixric earned 35 total points
ID: 10847740
HI!
If you're trying to edit a line from a database, and using this function left$(record.fields, 9) etc. , I guess using left$() alone will not work unless you used Mid(), but I assumed that it is in the etc. part :-) Anyway, you do exactly what is right to achieved the output you need. . And I might as well do the same method as you did for some advantages such as, you have breakdown particular piece on the record and its now more easy to identify for modification in the future.
Also,
You might do it using one variable with just a little knowledge in concatenation.
e.g.
Dim cWholePart as string

cWholepart = left(records.fields,19) & ":idtnum-" & Mid(records.fields,20,9) & ":new record: STATEMENTS-ID-" & Mid(records.fields,29,19) & ":zip-" & Mid(records.fields,48,6)
'Somewhat the last update will be like this
records.fields.edit
records.fields=cWholepart
records.fields.update

Hope this one helps. Gudluck.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
In this post we will learn different types of Android Layout and some basics of an Android App.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Starting up a Project

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question