Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-09-2012, 11:44 PM   #1
amolin
Newly Registered User
 
Join Date: Apr 2004
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
amolin is on a distinguished road
Expr1: Format("012P","0000") Why I get "0001"

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 by amolin; 10-09-2012 at 11:52 PM.
amolin is offline   Reply With Quote
Old 10-10-2012, 12:24 AM   #2
mahenkj2
Newly Registered User
 
Join Date: Apr 2012
Location: Earth
Posts: 459
Thanks: 58
Thanked 64 Times in 63 Posts
mahenkj2 is on a distinguished road
Re: Expr1: Format("012P","0000") Why I get "0001"

what you want to achieve?
mahenkj2 is offline   Reply With Quote
Old 10-10-2012, 04:37 PM   #3
amolin
Newly Registered User
 
Join Date: Apr 2004
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
amolin is on a distinguished road
Re: Expr1: Format("012P","0000") Why I get "0001"

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 by amolin; 10-10-2012 at 05:01 PM.
amolin is offline   Reply With Quote
Old 10-10-2012, 06:42 PM   #4
Galaxiom
Super Moderator
 
Join Date: Jan 2009
Location: NSW Australia
Posts: 11,560
Thanks: 88
Thanked 1,479 Times in 1,395 Posts
Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold Galaxiom is a splendid one to behold
Re: Expr1: Format("012P","0000") Why I get "0001"

It isn't a bug. You just need to understand the function better.
http://msdn.microsoft.com/en-us/libr.../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.
Galaxiom is offline   Reply With Quote
The Following User Says Thank You to Galaxiom For This Useful Post:
amolin (10-11-2012)
Old 10-10-2012, 08:33 PM   #5
mahenkj2
Newly Registered User
 
Join Date: Apr 2012
Location: Earth
Posts: 459
Thanks: 58
Thanked 64 Times in 63 Posts
mahenkj2 is on a distinguished road
Re: Expr1: Format("012P","0000") Why I get "0001"

There are other functions as well such Left, right, trim, INStr, Trim and many other, first tell what you want to extract.

mahenkj2 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query to Convert "Name" field to "Last Name" "First Name" "Middle Name"? derekbeck Queries 5 03-26-2012 03:23 PM
Qry To Exclude Record If All Fields On Page Is Blank Except Field "xx", "yy" And "zzz vancey Queries 0 03-17-2011 01:43 AM
Defaulting a "Medium Time" field to be "p.m." instead of "a.m."? Cobo Tables 4 04-26-2010 02:37 PM
query criteria - building "In" clause in "hidden" textbox - mult values wware Forms 3 03-11-2007 06:25 AM
Changing toolbar button setting from "Default Style" to "Image and Text" in VBA KeithWilliams Forms 0 10-20-2004 02:14 AM




All times are GMT -8. The time now is 07:58 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World