Expr1: Format("012P","0000") Why I get "0001" (1 Viewer)

amolin

Registered User.
Local time
Today, 15:26
Joined
Apr 29, 2004
Messages
35
Hi, Anyone know? when I use this function in Access Query design grid, we get wrong result?

Expr1: Format("012P","0000") Why I get "0001" thank you ! My Access Version is Access 2007.
 
Last edited:

amolin

Registered User.
Local time
Today, 15:26
Joined
Apr 29, 2004
Messages
35
Expr1: Format("012P","0000") , this expression should get "012P", I think this is a Access 2007 Bug,

Expr1: Format("011P","0000"), we also get wrong result ....
 
Last edited:

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 08:26
Joined
Jan 20, 2009
Messages
12,851
It isn't a bug. You just need to understand the function better.
http://msdn.microsoft.com/en-us/library/office/gg251755.aspx

"0000" is a number format. Its results are not defined for a string input and it generally passes the string straight through.

However it gets really confused if confronted with something it can see meaning in. The "P" is causing Format() to see the value as a Time (PM). You will get the same result when you include an "A" instead.

You need to tell us what you are trying to do. Post some examples of the input and what you want them to look like after being processed.
 

mahenkj2

Registered User.
Local time
Tomorrow, 03:56
Joined
Apr 20, 2012
Messages
459
There are other functions as well such Left, right, trim, INStr, Trim and many other, first tell what you want to extract.
 

Users who are viewing this thread

Top Bottom