Converting Text to Single

TT as a Text is equal
TT= "970531101235"
Then converted in P6 as below
P6 = CSng(TT)
Now P6 is equal 9.705311E+11
Which after formatting as below;
C6 = Format(P6, "#,####")
It is equal  970531100000
And truncated so the last 5 digits converted to zero.
I want to convert TT to a complete Number(970531101235 Single Percision).
How could I solve the problem?
S BAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Sub S()
Dim TT As String
TT = "970531101235"

With Range("P6")
    .NumberFormat = "0"
    .Value = CSng(TT)
End With
End Sub

Open in new window

Why not use CDbl(TT)?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I think that Decimal might hold this value as a number but Long Integer, Single, and Double will not.  Here's a good reference for Access data types.  Bookmark it.

Generally "numbers" this long are not actually numbers at all but codes.  You only need to store data in a numeric data type if you need to do arithmetic with it.  If you have long, variable length codes, you need to store them right justified by using leading zeros or spaces so they will sort and compare correctly.  Otherwise as straight text, 9 will be larger than 10 and will sort after 10.  Also after 100,000,000.000 because text fields are compared left to right; character by character.
Gustav BrockCIOCommented:
A Single cannot hold the precision needed.
So you must use Double or Decimal:

TT = "970531101235"
P6 = CDbl(TT)  ' or: P6 = CDec(TT)

? Format(P6, "#,###")

Open in new window

Also, you might be able to use TT "as is":

? Format(TT, "#,###")

Open in new window

S BAuthor Commented:
Thanks to all
Simply I used CDbl() and it solved
I could do some summation operations after conversion
Good luck
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.