Convert Scientific Number to Text

I

islandlover

I have a form which supplies credit card numbers to my access database. The
database however is converting those numbers to scientific numbers. I have
changed the field to Text, but that did nothing. I changed to a number field
with 0 decimal places and that appeared to work; however, when processing the
credit cards, I discovered the numbers all ended in 0 regardless of the real
cc number. I tried setting up a dummy field as text and then using an update
query from the old field, but it just copies the scientific numbers instead
of converting to text. I have worked on this for two days so please HELP.
Thanks.
 
J

John Spencer

Once the credit card "numbers" have been converted to a number field they
have lost the necessary precision to be converted back to TEXT. In a
sixteen character credit card number the last digit (16th) is always going
to be zero and the 15th digit is going to be wrong about 50 per cent of the
time due to rounding. Another problem is that if the card starts with
leading zero (or zeroes) the leading zeroes will get truncated ( I don't
know that this ever happens).

You need to make sure that you put the data into a text field at the start.

If you use Decimal type for the field you might be able to store the credit
card "Number" as a number

Conversion of what you have
CStr(CDec(1.23456789012346E+15)) will return 1234567890123460
However that started out as 1234567890123456

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
I

islandlover

Thank you, I was afraid that was the case!

John Spencer said:
Once the credit card "numbers" have been converted to a number field they
have lost the necessary precision to be converted back to TEXT. In a
sixteen character credit card number the last digit (16th) is always going
to be zero and the 15th digit is going to be wrong about 50 per cent of the
time due to rounding. Another problem is that if the card starts with
leading zero (or zeroes) the leading zeroes will get truncated ( I don't
know that this ever happens).

You need to make sure that you put the data into a text field at the start.

If you use Decimal type for the field you might be able to store the credit
card "Number" as a number

Conversion of what you have
CStr(CDec(1.23456789012346E+15)) will return 1234567890123460
However that started out as 1234567890123456

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top