Welcome to SPN

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

Sign Up Now!

On Close Code for character length

Discussion in 'Information Technology' started by Decembersonata, Nov 5, 2005.

  1. Decembersonata

    Decembersonata
    Expand Collapse
    Guest

    I need to create an on close Visual Basic code that creates a string that
    determines a predetermined character length (ten characters) and populates
    the field with leading zeros if it is less than ten characters. I am pretty
    new to Visual Basic so need some help with a simple code to produce this
    string.
     
  2. Loading...

    Similar Threads Forum Date
    India Who says we have skeletons only in our closets? Breaking News Aug 22, 2014
    India After Badrinath, Kedarnath now Sikh shrine Hemkunt Sahib closed temporarily Breaking News Jun 28, 2013
    Grammer / Vyakarn Fateh multimedia forced to close for lack of funds Language, Arts & Culture Nov 21, 2012
    General The Closer Videos Jul 26, 2012
    Close Brush with the Law, a Personal Story Business, Lifestyle & Leisure Sep 24, 2011

  3. fredg

    fredg
    Expand Collapse
    Guest

    On Fri, 4 Nov 2005 09:15:03 -0800, Decembersonata wrote:

    > I need to create an on close Visual Basic code that creates a string that
    > determines a predetermined character length (ten characters) and populates
    > the field with leading zeros if it is less than ten characters. I am pretty
    > new to Visual Basic so need some help with a simple code to produce this
    > string.


    To pad out a string with leading zeros:
    = string(10-len("ABC"),"0") & "ABC"
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail
     
  4. Rick B

    Rick B
    Expand Collapse
    Guest

    Did you read the responses to your other post?

    I assume this means that you have changed this field to a text field? If
    not, adding zeros before updating the table will not make any difference.

    If you have left this as a number field, did you set the "format" as
    directed in the previous posts?


    --
    Rick B



    "Decembersonata" <Decembersonata@discussions.microsoft.com> wrote in message
    news:94DEAFB8-CBF4-44E0-8B76-66DB1FFD35F0@microsoft.com...
    >I need to create an on close Visual Basic code that creates a string that
    > determines a predetermined character length (ten characters) and populates
    > the field with leading zeros if it is less than ten characters. I am
    > pretty
    > new to Visual Basic so need some help with a simple code to produce this
    > string.
     
  5. Decembersonata

    Decembersonata
    Expand Collapse
    Guest

    I did see your previous message but because of the database i'm connecting my
    database with, i need to keep it as a text field. so now i need to make an
    on exit event that produces the leading zeros.

    "Rick B" wrote:

    > Did you read the responses to your other post?
    >
    > I assume this means that you have changed this field to a text field? If
    > not, adding zeros before updating the table will not make any difference.
    >
    > If you have left this as a number field, did you set the "format" as
    > directed in the previous posts?
    >
    >
    > --
    > Rick B
    >
    >
    >
    > "Decembersonata" <Decembersonata@discussions.microsoft.com> wrote in message
    > news:94DEAFB8-CBF4-44E0-8B76-66DB1FFD35F0@microsoft.com...
    > >I need to create an on close Visual Basic code that creates a string that
    > > determines a predetermined character length (ten characters) and populates
    > > the field with leading zeros if it is less than ten characters. I am
    > > pretty
    > > new to Visual Basic so need some help with a simple code to produce this
    > > string.

    >
    >
    >
     
  6. Rick B

    Rick B
    Expand Collapse
    Guest

    I think the input mask in your form would do what you want.

    --
    Rick B



    "Decembersonata" <Decembersonata@discussions.microsoft.com> wrote in message
    news:005DDCDA-6949-4324-B5F4-B7001FB13EFC@microsoft.com...
    >I did see your previous message but because of the database i'm connecting
    >my
    > database with, i need to keep it as a text field. so now i need to make
    > an
    > on exit event that produces the leading zeros.
    >
    > "Rick B" wrote:
    >
    >> Did you read the responses to your other post?
    >>
    >> I assume this means that you have changed this field to a text field? If
    >> not, adding zeros before updating the table will not make any difference.
    >>
    >> If you have left this as a number field, did you set the "format" as
    >> directed in the previous posts?
    >>
    >>
    >> --
    >> Rick B
    >>
    >>
    >>
    >> "Decembersonata" <Decembersonata@discussions.microsoft.com> wrote in
    >> message
    >> news:94DEAFB8-CBF4-44E0-8B76-66DB1FFD35F0@microsoft.com...
    >> >I need to create an on close Visual Basic code that creates a string
    >> >that
    >> > determines a predetermined character length (ten characters) and
    >> > populates
    >> > the field with leading zeros if it is less than ten characters. I am
    >> > pretty
    >> > new to Visual Basic so need some help with a simple code to produce
    >> > this
    >> > string.

    >>
    >>
    >>
     

Share This Page