Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have some data in database (ACCESS) which looks like this:-
Id  SName
1   GLE1/001
2   01
3   498
4   HYEP/0089

now, when i retrieve the data to datatable from this query
"Select Id,Format(SName) from Item".
It gives me the following record:-
Id  SName
1   GLE1/001
2   1          //here "01" got converted to "1"
3   498
4   HYEP/0089

The Name field's datatype is Memo Or LongText.
Why is it converting "01" to "1"?
Posted

1 solution

Because you are using the FORMAT function:

"The Microsoft Access Format function takes a numeric expression and returns it as a formatted string."
http://www.techonthenet.com/access/functions/numeric/format.php[^]

So in order to pass it a numeric value, the string "01" is converted to a number - 1 - and then FORMATED back to a string...

Take the FORMAT out and it should do what you want.
 
Share this answer
 
Comments
agent_kruger 20-May-14 15:35pm    
thank you sir, it worked just fine.
OriginalGriff 20-May-14 15:59pm    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900