Format date from textbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Graham Feeley

    #1

    Format date from textbox

    Hi I am using a form to add records and my main hurdle is using 3 unbound
    textboxes to add the date to a bound textbox.
    EG: Unbound boxes
    Tbox0 = 2006......./obviously the year and (tabstop=NO)
    Tbox1 = 12 whatever I type which is day
    Tbox2 = 7 whatever I type which is month
    and textbox3 = bound to table[transactions] to field [TranDate]

    I would like to update texbox 3 with the formatted date from the unbound
    boxes in dd/mm/yyyy
    which i guess will be in the After Update property

    Any help will be appreciated and i may say the reason for not using the
    calendar control is I am entering dates for year 2006 and that takes a lot
    of mouse clicks
    Regards
    Graham



  • fredg

    #2
    Re: Format date from textbox

    On Sat, 2 Aug 2008 11:15:30 +1000, Graham Feeley wrote:
    Hi I am using a form to add records and my main hurdle is using 3 unbound
    textboxes to add the date to a bound textbox.
    EG: Unbound boxes
    Tbox0 = 2006......./obviously the year and (tabstop=NO)
    Tbox1 = 12 whatever I type which is day
    Tbox2 = 7 whatever I type which is month
    and textbox3 = bound to table[transactions] to field [TranDate]
    >
    I would like to update texbox 3 with the formatted date from the unbound
    boxes in dd/mm/yyyy
    which i guess will be in the After Update property
    >
    Any help will be appreciated and i may say the reason for not using the
    calendar control is I am entering dates for year 2006 and that takes a lot
    of mouse clicks
    Regards
    Graham

    Are all the records for year 2006?
    Strange method to do this.
    Which is the final control into which data is added.
    Let's say it's [TBox2].
    Code the [TBox2] AfterUpdate event:
    Me.[TextBox3] = DateSerial([TBox0],[TBox1],[TBox2])

    You can even forget about [TBox0].
    Me.[TextBox3] = DateSerial(2006 ,[TBox1],[TBox2])


    But ... why not use one control [TextBox3]?
    Add an InputMask.
    99/99/"2006";0;_

    Now all the user need do is enter the month and day.
    When/if you no longer want to only enter records for 2006, delete or
    change the mask.

    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail

    Comment

    • Graham Feeley

      #3
      Re: Format date from textbox

      WOW....Thans for the answer and very prompt also...Like I only posted this
      five min ago...LOL
      Well you are right about the Mask, just did'nt know the answer
      I really appreciate it

      Regards
      Graham

      "fredg" <fgutkind@examp le.invalidwrote in message
      news:496gwdl3w1 rg.17c5n69csufq h.dlg@40tude.ne t...
      On Sat, 2 Aug 2008 11:15:30 +1000, Graham Feeley wrote:
      >
      >Hi I am using a form to add records and my main hurdle is using 3 unbound
      >textboxes to add the date to a bound textbox.
      >EG: Unbound boxes
      >Tbox0 = 2006......./obviously the year and (tabstop=NO)
      >Tbox1 = 12 whatever I type which is day
      >Tbox2 = 7 whatever I type which is month
      >and textbox3 = bound to table[transactions] to field [TranDate]
      >>
      >I would like to update texbox 3 with the formatted date from the unbound
      >boxes in dd/mm/yyyy
      >which i guess will be in the After Update property
      >>
      >Any help will be appreciated and i may say the reason for not using the
      >calendar control is I am entering dates for year 2006 and that takes a
      >lot
      >of mouse clicks
      >Regards
      >Graham
      >
      >
      Are all the records for year 2006?
      Strange method to do this.
      Which is the final control into which data is added.
      Let's say it's [TBox2].
      Code the [TBox2] AfterUpdate event:
      Me.[TextBox3] = DateSerial([TBox0],[TBox1],[TBox2])
      >
      You can even forget about [TBox0].
      Me.[TextBox3] = DateSerial(2006 ,[TBox1],[TBox2])
      >
      >
      But ... why not use one control [TextBox3]?
      Add an InputMask.
      99/99/"2006";0;_
      >
      Now all the user need do is enter the month and day.
      When/if you no longer want to only enter records for 2006, delete or
      change the mask.
      >
      --
      Fred
      Please respond only to this newsgroup.
      I do not reply to personal e-mail

      Comment

      • fredg

        #4
        Re: Format date from textbox

        On Sat, 2 Aug 2008 11:15:30 +1000, Graham Feeley wrote:
        Hi I am using a form to add records and my main hurdle is using 3 unbound
        textboxes to add the date to a bound textbox.
        EG: Unbound boxes
        Tbox0 = 2006......./obviously the year and (tabstop=NO)
        Tbox1 = 12 whatever I type which is day
        Tbox2 = 7 whatever I type which is month
        and textbox3 = bound to table[transactions] to field [TranDate]
        >
        I would like to update texbox 3 with the formatted date from the unbound
        boxes in dd/mm/yyyy
        which i guess will be in the After Update property
        >
        Any help will be appreciated and i may say the reason for not using the
        calendar control is I am entering dates for year 2006 and that takes a lot
        of mouse clicks
        Regards
        Graham
        The month is the last entry?
        If this is how you wish to do this, code the Tbox2 AfterUpdate event:
        Me.TextBox3 = DateSerial([TBox0],[TBox2],[TBox1])

        However, why not forget about those 3 controls and just code the
        Textbox3 AfterUpdate event:
        Me.Textbox3 = DateSerial(2006 ,Month(Textbox3]),Day([TextBox3]))

        Enter 9/12 in [Textbox3] and it will become 9/12/2006


        --
        Fred
        Please respond only to this newsgroup.
        I do not reply to personal e-mail

        Comment

        Working...