Create a calculated date in a field on input form

Discussion in 'Microsoft Access Form Coding' started by Steve in S.F., Oct 24, 2008.

  1. I need to create an input form in which there is a field for the user to
    input a year. After the user enters a year I would like a date to appear in
    another field. The date would always be the same month and day (June 1) and
    the year would be six years before the date entered in the Year field.

    So for example if the user enters "2010" in the Year field, the calculated
    Date Field would show: 06/01/2004.

    Is there some formula (I guess using some date function) that I can use in
    the Control Source property of the Date Field that would yield the date that
    I need? Or any other method to get this result?

    Thanks,

    Steve
     
    Steve in S.F., Oct 24, 2008
    #1
    1. Advertisements

  2. Steve in S.F. wrote:

    >I need to create an input form in which there is a field for the user to
    >input a year. After the user enters a year I would like a date to appear in
    >another field. The date would always be the same month and day (June 1) and
    >the year would be six years before the date entered in the Year field.
    >
    >So for example if the user enters "2010" in the Year field, the calculated
    >Date Field would show: 06/01/2004.
    >
    >Is there some formula (I guess using some date function) that I can use in
    >the Control Source property of the Date Field that would yield the date that
    >I need? Or any other method to get this result?



    =DateSerial(YearField - 6, 6, 1)

    --
    Marsh
    MVP [MS Access]
     
    Marshall Barton, Oct 24, 2008
    #2
    1. Advertisements

  3. Thanks so much - I don't even find that function in help for either Access or
    Excel, but it definitely works!

    "Marshall Barton" wrote:

    > Steve in S.F. wrote:
    >
    > >I need to create an input form in which there is a field for the user to
    > >input a year. After the user enters a year I would like a date to appear in
    > >another field. The date would always be the same month and day (June 1) and
    > >the year would be six years before the date entered in the Year field.
    > >
    > >So for example if the user enters "2010" in the Year field, the calculated
    > >Date Field would show: 06/01/2004.
    > >
    > >Is there some formula (I guess using some date function) that I can use in
    > >the Control Source property of the Date Field that would yield the date that
    > >I need? Or any other method to get this result?

    >
    >
    > =DateSerial(YearField - 6, 6, 1)
    >
    > --
    > Marsh
    > MVP [MS Access]
    >
     
    Steve in S.F., Oct 25, 2008
    #3
  4. Steve in S.F.

    Mike Painter Guest

    Open a module and click on help. It will give you VBA information that
    contains things like this.
    Steve in S.F. wrote:
    > Thanks so much - I don't even find that function in help for either
    > Access or Excel, but it definitely works!
    >
    > "Marshall Barton" wrote:
    >
    >> Steve in S.F. wrote:
    >>
    >>> I need to create an input form in which there is a field for the
    >>> user to input a year. After the user enters a year I would like a
    >>> date to appear in another field. The date would always be the same
    >>> month and day (June 1) and the year would be six years before the
    >>> date entered in the Year field.
    >>>
    >>> So for example if the user enters "2010" in the Year field, the
    >>> calculated Date Field would show: 06/01/2004.
    >>>
    >>> Is there some formula (I guess using some date function) that I can
    >>> use in the Control Source property of the Date Field that would
    >>> yield the date that I need? Or any other method to get this result?

    >>
    >>
    >> =DateSerial(YearField - 6, 6, 1)
    >>
    >> --
    >> Marsh
    >> MVP [MS Access]
     
    Mike Painter, Oct 25, 2008
    #4
  5. I should have thought of that -- Thanks!

    "Mike Painter" wrote:

    >
    > Open a module and click on help. It will give you VBA information that
    > contains things like this.
    > Steve in S.F. wrote:
    > > Thanks so much - I don't even find that function in help for either
    > > Access or Excel, but it definitely works!
    > >
    > > "Marshall Barton" wrote:
    > >
    > >> Steve in S.F. wrote:
    > >>
    > >>> I need to create an input form in which there is a field for the
    > >>> user to input a year. After the user enters a year I would like a
    > >>> date to appear in another field. The date would always be the same
    > >>> month and day (June 1) and the year would be six years before the
    > >>> date entered in the Year field.
    > >>>
    > >>> So for example if the user enters "2010" in the Year field, the
    > >>> calculated Date Field would show: 06/01/2004.
    > >>>
    > >>> Is there some formula (I guess using some date function) that I can
    > >>> use in the Control Source property of the Date Field that would
    > >>> yield the date that I need? Or any other method to get this result?
    > >>
    > >>
    > >> =DateSerial(YearField - 6, 6, 1)
    > >>
    > >> --
    > >> Marsh
    > >> MVP [MS Access]

    >
    >
    >
     
    Steve in S.F., Oct 25, 2008
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kderaedt

    Copy value calculated field subform to a field

    kderaedt, Jun 30, 2003, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    665
    kderaedt
    Jun 30, 2003
  2. PC Datasheet

    Re: Getting Date field to automatically input current date

    PC Datasheet, Aug 11, 2004, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    380
    PC Datasheet
    Aug 11, 2004
  3. Charlie Klein

    Getting Date field to automatically input current date

    Charlie Klein, Aug 11, 2004, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    140
    Charlie Klein
    Aug 11, 2004
  4. SteveS

    Re: Populate form field based on input of previous field...

    SteveS, Sep 16, 2004, in forum: Microsoft Access Form Coding
    Replies:
    2
    Views:
    673
    SteveS
    Sep 17, 2004
  5. Thorfinn

    CALCULATED VALUES IN A FORM BASED ON USER DATA INPUT

    Thorfinn, Jun 16, 2009, in forum: Microsoft Access Form Coding
    Replies:
    3
    Views:
    362
    Thorfinn
    Jun 23, 2009
Loading...

Share This Page