Solved

visual basic editting a line from database

Posted on 2004-04-16
2
230 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
A short article about a problem I had getting the GPS LocationListener working.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now