Production Date/Expiry Date

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • William Bradley

    Production Date/Expiry Date

    I have two cells on a form. One of them is the "Production Date" and the
    other is the "Expiry Date". The "Expiry Date" is 183 days after the
    "Production Date."

    On an Excel spreadsheet, the "Expiry Date" is automatically entered, when
    the "Production Date" is entered. To do this the "Expiry Date" cell carries
    the following formula: "=A15+183".

    I would like to be able to do the same on an Access Form, with the results
    written to the underlying table.

    Any help is appreciated,

    Bill.


  • Rick Brandt

    #2
    Re: Production Date/Expiry Date

    "William Bradley" <bradleyw@magma .ca> wrote in message
    news:zfOdnRSP5O U-esmiU-KYgw@magma.ca.. .[color=blue]
    > I have two cells on a form. One of them is the "Production Date" and the
    > other is the "Expiry Date". The "Expiry Date" is 183 days after the
    > "Production Date."
    >
    > On an Excel spreadsheet, the "Expiry Date" is automatically entered, when
    > the "Production Date" is entered. To do this the "Expiry Date" cell carries
    > the following formula: "=A15+183".
    >
    > I would like to be able to do the same on an Access Form, with the results
    > written to the underlying table.[/color]

    This all made perfect sense until the last sentence. Why do you want to store this
    value rather than calculate it on the fly? That is what Excel is doing. Why not
    have Access do the same? Storing this in the table would make as much sense as
    writing a macro in Excel that would Add 183 to the values found in column A and
    writing the result to column B. Then every time you change something in column A you
    would re-run the macro to make sure that column B is correct. Sounds silly when you
    can just enter an expression in column B to do all of this for you automatically
    doesn't it?

    Just use a control on the form with an expression as its ControlSource that will do
    the calculation and display the result. Saving it to the table accomplishes nothing
    useful.


    Comment

    • William Bradley

      #3
      Re: Production Date/Expiry Date

      "Tim Satterwhite" <timothy.satter white@ucsfmedct r.org> wrote in message
      news:bj38hb$11q i@itssrv1.ucsf. edu...[color=blue]
      > Not to get too far off the subject, but it might be useful to store the
      > expiry date.
      >
      > If the user is allowed or required by business practice (say, in the case[/color]
      of[color=blue]
      > negotiations with the database user's customers) to override the default[/color]
      of[color=blue]
      > production + 183 days, then it needs to be stored.
      >
      > Of course, this all depends on what the purpose of "production " and[/color]
      "expiry"[color=blue]
      > are. Whether the data should be stored or not is totally dependent on the
      > need for that derived information.[/color]

      We manufacture biological products used in both medical, veterinary,
      industrial and food investigations. We need to have hard coded information
      on both the production date and expiry date of each product as it is
      produced.

      Bill.


      Comment

      • William Bradley

        #4
        Re: Production Date/Expiry Date


        "Marshall Barton" <marshbarton@wo wway.com> wrote in message
        news:9as9lvgpnp 783kogctb88c8gi aepb5uf6g@4ax.c om...[color=blue]
        > William Bradley wrote:
        >[color=green]
        > >I have two cells on a form. One of them is the "Production Date" and the
        > >other is the "Expiry Date". The "Expiry Date" is 183 days after the
        > >"Production Date."
        > >
        > >On an Excel spreadsheet, the "Expiry Date" is automatically entered, when
        > >the "Production Date" is entered. To do this the "Expiry Date" cell[/color][/color]
        carries[color=blue][color=green]
        > >the following formula: "=A15+183".
        > >
        > >I would like to be able to do the same on an Access Form, with the[/color][/color]
        results[color=blue][color=green]
        > >written to the underlying table.[/color]
        >
        > I think what you're asking for can be done by using a line
        > of code in the Production Date text box's AfterUpdate event
        > procedure:
        >
        > txtExpiryDate = DateAdd("d", 183, txtProductionDa te)[/color]

        Thank you for the above Marsh. I already have a line of code in the "After
        Update" of the "ProductionDate " field. Is it possible to add yours, abvove,
        as well? If so how? I tried it and it didn't work, probably due to my
        missing something out.

        Thank you,

        Bill.


        Comment

        • Marshall Barton

          #5
          Re: Production Date/Expiry Date

          William Bradley wrote:
          [color=blue]
          >
          >"Marshall Barton" <marshbarton@wo wway.com> wrote in message
          >news:9as9lvgpn p783kogctb88c8g iaepb5uf6g@4ax. com...[color=green]
          >> William Bradley wrote:
          >>[color=darkred]
          >> >I have two cells on a form. One of them is the "Production Date" and the
          >> >other is the "Expiry Date". The "Expiry Date" is 183 days after the
          >> >"Production Date."
          >> >
          >> >On an Excel spreadsheet, the "Expiry Date" is automatically entered, when
          >> >the "Production Date" is entered. To do this the "Expiry Date" cell[/color][/color]
          >carries[color=green][color=darkred]
          >> >the following formula: "=A15+183".
          >> >
          >> >I would like to be able to do the same on an Access Form, with the[/color][/color]
          >results[color=green][color=darkred]
          >> >written to the underlying table.[/color]
          >>
          >> I think what you're asking for can be done by using a line
          >> of code in the Production Date text box's AfterUpdate event
          >> procedure:
          >>
          >> txtExpiryDate = DateAdd("d", 183, txtProductionDa te)[/color]
          >
          >Thank you for the above Marsh. I already have a line of code in the "After
          >Update" of the "ProductionDate " field. Is it possible to add yours, abvove,
          >as well? If so how? I tried it and it didn't work, probably due to my
          >missing something out.[/color]

          Sure you can add a line of code to your existing procedure.

          That line is simple enough that I can't see how you could be
          leaving something out. Maybe you didn't change the names I
          used to the ones you're using. Make sure that you replace
          txtExpiryDate with the name of the text box bound to the
          Expiry Date field. Similarly change txtProductionDa te to
          the name of the text box bound to the Production Date field.

          --
          Marsh

          Comment

          Working...