PC Review


Reply
Thread Tools Rate Thread

How To Append Trailing Zero

 
 
keali
Guest
Posts: n/a
 
      14th May 2004
for example:
A1 = 123
A1=123000 <- final result

A1 =1234
A1=123400<- final result

A1=1
A1=100000<-final result

How do i append trailing zero? is there a function that i
can use for this?
i cannot use format(A1,"000000") because it append zero in
front.
 
Reply With Quote
 
 
 
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      14th May 2004
Keali,
Is A1 a String or a Integer?

Have you tried the String.PadRight function?

Dim A1 As String = "123"
A1 = A1.PadRight(6, "0"c)

If A1 is an Integer, I'm not sure of a "better" (another) method then
converting to a string, using PadRight, and converting back.

Hope this helps
Jay

"keali" <(E-Mail Removed)> wrote in message
news:d32201c439b0$e7512a60$(E-Mail Removed)...
> for example:
> A1 = 123
> A1=123000 <- final result
>
> A1 =1234
> A1=123400<- final result
>
> A1=1
> A1=100000<-final result
>
> How do i append trailing zero? is there a function that i
> can use for this?
> i cannot use format(A1,"000000") because it append zero in
> front.



 
Reply With Quote
 
Eidolon
Guest
Posts: n/a
 
      14th May 2004
You could do

A1 = CStr(123).PadRight(5,"0")
This will pad your var to a _total width_ of 5, .... not "with 5 zeroes".

Or if you know you need it padded with 5 zeroes always, you could do
A1 = 123 * (10^5)

"keali" <(E-Mail Removed)> wrote in message
news:d32201c439b0$e7512a60$(E-Mail Removed)...
> for example:
> A1 = 123
> A1=123000 <- final result
>
> A1 =1234
> A1=123400<- final result
>
> A1=1
> A1=100000<-final result
>
> How do i append trailing zero? is there a function that i
> can use for this?
> i cannot use format(A1,"000000") because it append zero in
> front.



 
Reply With Quote
 
keali lim
Guest
Posts: n/a
 
      14th May 2004
Hi Jay B. Harlow [MVP - Outlook], Eidolon

thank for the reply, it's really help me a lot
thank a zillions

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Append query to append lots of record with range input domibud Microsoft Access Queries 7 9th May 2008 02:26 AM
INSERT SQL to append recs frm another Table, NULL DATE append 30/1 accesshar Microsoft Access VBA Modules 2 14th Jan 2008 02:00 PM
What is the easiest way to open a textfile for append or create it for text append? Wolfgang Meister Microsoft C# .NET 3 23rd May 2007 04:15 PM
Append Query in VBA - to append VBA variable values to Access tabl =?Utf-8?B?QWdlbnQgRGFnbmFtaXQ=?= Microsoft Access VBA Modules 4 1st Nov 2006 04:25 PM
How To Append Trailing Zeros Keali Microsoft Dot NET 2 14th May 2004 01:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:57 PM.