Solved

visual basic editting a line from database

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
array11 challenge 16 60
Editing a video 12 44
delphi parse string to params 3 100
Recommendation vb6 to vb.net or others 14 111
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
A short article about problems I had with the new location API and permissions in Marshmallow
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now