A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I allow a leading zero in an Access number field?



 
 
Thread Tools Display Modes
  #1  
Old December 10th, 2008, 03:27 PM posted to microsoft.public.access.tablesdbdesign
George
external usenet poster
 
Posts: 883
Default How do I allow a leading zero in an Access number field?

I have a 5 digit number that may or may not have a leading zero. This is the
key field in the database. I need it to allow and display a leading zero.
  #2  
Old December 10th, 2008, 03:44 PM posted to microsoft.public.access.tablesdbdesign
Beetle
external usenet poster
 
Posts: 1,254
Default How do I allow a leading zero in an Access number field?

Change it to a text field. Number (integer) data types cannot have leading
zeros.
--
_________

Sean Bailey


"George" wrote:

I have a 5 digit number that may or may not have a leading zero. This is the
key field in the database. I need it to allow and display a leading zero.

  #3  
Old December 10th, 2008, 04:59 PM posted to microsoft.public.access.tablesdbdesign
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default How do I allow a leading zero in an Access number field?

You can use the Format function, which returns a string. In a query field:

NewField: Format([NumberField],"00000")

In the Control Source of an unbound text box:
= Format([NumberField],"00000")

"George" wrote in message
...
I have a 5 digit number that may or may not have a leading zero. This is
the
key field in the database. I need it to allow and display a leading zero.


  #4  
Old December 10th, 2008, 05:23 PM posted to microsoft.public.access.tablesdbdesign
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default How do I allow a leading zero in an Access number field?

Hi,

Or, just set the Format property of the text box to 00000.

Clifford Bass

"BruceM" wrote:

You can use the Format function, which returns a string. In a query field:

NewField: Format([NumberField],"00000")

In the Control Source of an unbound text box:
= Format([NumberField],"00000")

"George" wrote in message
...
I have a 5 digit number that may or may not have a leading zero. This is
the
key field in the database. I need it to allow and display a leading zero.

  #5  
Old December 10th, 2008, 06:49 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default How do I allow a leading zero in an Access number field?

On Wed, 10 Dec 2008 07:27:01 -0800, George
wrote:

I have a 5 digit number that may or may not have a leading zero. This is the
key field in the database. I need it to allow and display a leading zero.


5, 05, 00005 and 000000000000000000000000000005 are *all the same number*, and
they are stored in the same way (binary 00000000 00000000 00000000 00000101 if
it matters).

If you want to store leading zeros and make a distinction between values with
and without leading zeroes then you must store the data in a Text field, not a
Number.
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.