?
Solved

visual basic editting a line from database

Posted on 2004-04-16
2
Medium Priority
?
237 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 105 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 real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

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…
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

801 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