format("#d#")

A

Alex \(PR\)

I just found out that when I'm using format function on
the following string it doesn't return what I'd expected:
EX- strvar=format("89d30","00000")
RETURNS- "89000000000000000000000000000000"
INSTEAD OF- "89d30"

I've also learned it from the letter "e". I've tried to
look over and over the help files, the on-line
KnowledgeBase, etc. I would like to know where can I find
some document(s) or article(s) which contain(s) all the
possible reserved numeric constants for Access 97.

THANX
 
A

Albert D. Kallal

The problem is that even if you convert the value to a string (actually that
is what you have), using format thinks it is a number.

The solution in your case would be to build a custom form as function. You
can use something like:

right("00000" & "89d30",5)

So, the solution is not go hunting for symbols can represent a number, as
once you find those symbols...what will you do? It don't help you!

The solution is to format the results as a string...and to NOT let ms-access
try and convert it to number expression.
 
J

John Vinson

I just found out that when I'm using format function on
the following string it doesn't return what I'd expected:
EX- strvar=format("89d30","00000")
RETURNS- "89000000000000000000000000000000"
INSTEAD OF- "89d30"

I've also learned it from the letter "e". I've tried to
look over and over the help files, the on-line
KnowledgeBase, etc. I would like to know where can I find
some document(s) or article(s) which contain(s) all the
possible reserved numeric constants for Access 97.

89E30 means "a single precision floating point number, 89 times 10 to
the 30th power"; 89D30 means the same only double precision not
single.

Why are you trying to format a text string containing non-digits (I
presume) as five digits? What do you expect to see?
 
V

Van T. Dinh

D & E have special meaning in numeric values. They mean multiply with 10 to
the powers {the number after D or E}. Since you use a Numeric Formatting
String, Access type-casts you String to a Number with value:

89 * 10^30

which means that you get 30 zeros after 89.

Not sure why you have to use the Format() function, though. Perhaps the
sample "89D30" is not a good sample and you have other data that needs
formatting.

HTH
Van T. Dinh
MVP (Access)
 

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