How would I make a number 16 characters long (CC Number) display on the screen without any deformation?
Thanks.
Printable View
How would I make a number 16 characters long (CC Number) display on the screen without any deformation?
Thanks.
Not sure if this is what you meant...
Code:long_number = right("0000000000000000" & short_number,16)
What I'm doing is taking an integer out of a database and trying to display it on the screen. If I just try to write it (rst("whatever")) Then it looks like this:
1.23456781234568E+15
Whatever I try to do from there is not working because it's already rounded it at the end (68E... instead of 678).
Any help would be greatly appreciated.
Aren't there any properties for that field in the dbase, so that it doesn't round it?
And when there is such big numbers as it is here.. is it such a big deal if the last digit is rounded?
It looks fine in the database, I just can't get it to display on the page the same as it looks in the database. It's a credit card number which is why it's 16 digits so yes it is important that we record the correct one also.
Hehe.. if it's a credit card-number I can understand that :D
If you don't need to make any mathematical operations on it, why not save it in the dbase as a string?
I wish that were something that took place before all of this. I am trying to work with someone elses code and this is the only step I am unable to make it past. I can go into the other pages that reference this application and rewrite them but that's a pain.
Is there no other options?
Can only think of one thing...
int(rst("whatever"))
I'm sure there must be some way, if this doesn't work, but I don't know exactly how... take a look at MSDN if you can find anything.
You have to use a long not an int. Int is not big enough to handle it. It really should have been stored as a string initially. But, since that isn't possible now.. let's see..
Have you tried using FormatNumber() ?
Yes I have, but that's not successful either.
The problem I'm having when doing that is the number is rounded to 15 numbers and a 0 at the end.
(ie. - 1234567812345678 would be 1.234567812345680)
I am very close to fixing it, but it's still not working exactly right.
As of right now I have found that if I manually change all numbers to having a letter before the numbers it reads it as a string and it works fine.
I just have to write a script which adds a letter (a) to the beginning of each number and write it back to itself. That shouldn't be a problem except I'm writing to a .csv file instead of a db which I'm not familiar with. I get an error when trying to add an "a" before the number which tells me it's a type mismatch. I don't know how it knows it's supposed to be a number field instead of a text field.
Thanks for any help.