|
-
Oct 17th, 2005, 08:20 PM
#1
Thread Starter
New Member
String Manipulation
I am using Visual Basic in Access for programming the Macros. I am using the access database to acquire data from lab instruments. I am using a bar code scanner and the output is as follows 103329. Now what I need to do is change it to 103320 (meaning I need to replace the last character with number 0). The last digit cud be any number and needs to be replaced with a 0. Please help
-
Oct 18th, 2005, 06:39 AM
#2
Re: String Manipulation
Moved to Office Development forum
Hi ksushma, welcome to VBForums! 
This can be acheived by using a little string manipulation, using functions such as Left and Len. You haven't mentioned if the number is a fixed length, if it is you could use something like this:
VB Code:
[I]OutputText[/I] = Left([I]InputText[/I],5) & "0"
However, if the length can vary you need to find the length too, using the Len function, eg:
VB Code:
[I]OutputText[/I] = Left([I]InputText[/I],Len([I]InputText[/I])) & "0"
-
Oct 18th, 2005, 06:55 AM
#3
Re: String Manipulation
Minor correction:
Code:
OutputText = Left(InputText,Len(InputText) -1) & "0"
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Oct 18th, 2005, 06:57 AM
#4
-
Oct 18th, 2005, 08:16 AM
#5
Thread Starter
New Member
Re: String Manipulation
Thank you very much it worked!!I will come back with more questions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|