Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Text field format fills?

Discussion in 'Information Technology' started by Darren, Jul 28, 2006.

  1. Darren

    Darren
    Expand Collapse
    Guest

    I have a four digit text field that combines letters and numbers. When the
    field is all numbers and starts with one or more zeroes it drops the zeros.
    Any way to automatically show all four digits on a report? I have done this
    with number fields, but unfortunately this needs letters as well.
    EX: data table = 123, report = 123, want report to show 0123.

    Thank you.
     
  2. Loading...

    Similar Threads Forum Date
    Malaysia Hindus, Sikhs In Malaysia Appalled With University Textbook Ridiculing Their Faiths Breaking News Jun 14, 2016
    Hard Talk Taking One Liners Out Of Context From Gurbani To Allow Intellectual Independence? Hard Talk Apr 23, 2016
    India Protests in India Over the Desecration of a Holy Text Leave Two Dead Breaking News Oct 16, 2015
    Learn Punjabi Convert Punjabi text Language, Arts & Culture Oct 11, 2013
    Sikh Coalition Harmeet Kaur Took the Lead ! First to Respond to Textbook Challenge ! Sikh Organisations May 25, 2013

  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    1. Open the report in design view.

    2. Right-click the text box, and choose Properties.

    3. On the Format tab of the Properties box, set the Format property to:
    0000

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Darren" <Darren@discussions.microsoft.com> wrote in message
    news:F633E833-29A2-484A-914D-922850986CAA@microsoft.com...
    >I have a four digit text field that combines letters and numbers. When the
    > field is all numbers and starts with one or more zeroes it drops the
    > zeros.
    > Any way to automatically show all four digits on a report? I have done
    > this
    > with number fields, but unfortunately this needs letters as well.
    > EX: data table = 123, report = 123, want report to show 0123.
    >
    > Thank you.
     
  4. Darren

    Darren
    Expand Collapse
    Guest

    This works for me when the Data Type is a number, but it doesn't work for
    when the Data Type is Text - should it?

    Thanks for your help!!!

    "Allen Browne" wrote:

    > 1. Open the report in design view.
    >
    > 2. Right-click the text box, and choose Properties.
    >
    > 3. On the Format tab of the Properties box, set the Format property to:
    > 0000
    >
    > --
    > Allen Browne - Microsoft MVP. Perth, Western Australia.
    > Tips for Access users - http://allenbrowne.com/tips.html
    > Reply to group, rather than allenbrowne at mvps dot org.
    >
    > "Darren" <Darren@discussions.microsoft.com> wrote in message
    > news:F633E833-29A2-484A-914D-922850986CAA@microsoft.com...
    > >I have a four digit text field that combines letters and numbers. When the
    > > field is all numbers and starts with one or more zeroes it drops the
    > > zeros.
    > > Any way to automatically show all four digits on a report? I have done
    > > this
    > > with number fields, but unfortunately this needs letters as well.
    > > EX: data table = 123, report = 123, want report to show 0123.
    > >
    > > Thank you.

    >
    >
    >
     
  5. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    How are you assigning the value to the text field?

    If you're using

    TextField = NumericField

    try

    TextField = Format(NumericField, "0000")

    or

    TextField = Right("0000" & NumericField, 4)

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Darren" <Darren@discussions.microsoft.com> wrote in message
    news:F633E833-29A2-484A-914D-922850986CAA@microsoft.com...
    > I have a four digit text field that combines letters and numbers. When the
    > field is all numbers and starts with one or more zeroes it drops the

    zeros.
    > Any way to automatically show all four digits on a report? I have done

    this
    > with number fields, but unfortunately this needs letters as well.
    > EX: data table = 123, report = 123, want report to show 0123.
    >
    > Thank you.
     
  6. Darren

    Darren
    Expand Collapse
    Guest

    Thanks for helping, I guess that this is over my head.

    "Douglas J Steele" wrote:

    > How are you assigning the value to the text field?
    >
    > If you're using
    >
    > TextField = NumericField
    >
    > try
    >
    > TextField = Format(NumericField, "0000")
    >
    > or
    >
    > TextField = Right("0000" & NumericField, 4)
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Darren" <Darren@discussions.microsoft.com> wrote in message
    > news:F633E833-29A2-484A-914D-922850986CAA@microsoft.com...
    > > I have a four digit text field that combines letters and numbers. When the
    > > field is all numbers and starts with one or more zeroes it drops the

    > zeros.
    > > Any way to automatically show all four digits on a report? I have done

    > this
    > > with number fields, but unfortunately this needs letters as well.
    > > EX: data table = 123, report = 123, want report to show 0123.
    > >
    > > Thank you.

    >
    >
    >
     
  7. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    If the data type is Text, you could use:
    =Format(Val(Nz([MyField], "0")), "0000")
    or perhaps
    =IIf(Len([MyField]) < 4, String(4 - Len([MyField]), "0"),Null) &
    [MyField]

    Be sure to change the Name of your text box as well. Access gets confused if
    the control has the same name as a field, but is bound to something else.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Darren" <Darren@discussions.microsoft.com> wrote in message
    news:776C25AD-F38E-48D6-9E84-1FE5D89D79BE@microsoft.com...
    > This works for me when the Data Type is a number, but it doesn't work for
    > when the Data Type is Text - should it?
    >
    > Thanks for your help!!!
    >
    > "Allen Browne" wrote:
    >
    >> 1. Open the report in design view.
    >>
    >> 2. Right-click the text box, and choose Properties.
    >>
    >> 3. On the Format tab of the Properties box, set the Format property to:
    >> 0000
    >>
    >> "Darren" <Darren@discussions.microsoft.com> wrote in message
    >> news:F633E833-29A2-484A-914D-922850986CAA@microsoft.com...
    >> >I have a four digit text field that combines letters and numbers. When
    >> >the
    >> > field is all numbers and starts with one or more zeroes it drops the
    >> > zeros.
    >> > Any way to automatically show all four digits on a report? I have done
    >> > this
    >> > with number fields, but unfortunately this needs letters as well.
    >> > EX: data table = 123, report = 123, want report to show 0123.
    >> >
    >> > Thank you.
     

Share This Page