Welcome to SPN

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

Sign Up Now!

Adding Currency?

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

  1. Code Agent

    Code Agent
    Expand Collapse
    Guest

    I have 2 currency fields in a form. I also have another field that calculates
    the 2 when added. the problem I am having is if I dont put info in both
    fields i cant get an amount in the third.

    ex. Field 1: = $25.00
    Field 2 = $30.00
    Field 3 = field 1 and 2 added which is $55.00

    I would like to be able to have the option of only entering in Field 1 and
    have Field 3 = field 1 if there is nothing in field 2, but when I decide to
    put info in field 2 then field three calculates the total of field 1 and 2.

    I don't know if that makes any sence but I appreciate any help.
     
  2. fredg

    fredg
    Expand Collapse
    Guest

    On Wed, 21 Jun 2006 10:25:02 -0700, Code Agent wrote:

    > I have 2 currency fields in a form. I also have another field that calculates
    > the 2 when added. the problem I am having is if I dont put info in both
    > fields i cant get an amount in the third.
    >
    > ex. Field 1: = $25.00
    > Field 2 = $30.00
    > Field 3 = field 1 and 2 added which is $55.00
    >
    > I would like to be able to have the option of only entering in Field 1 and
    > have Field 3 = field 1 if there is nothing in field 2, but when I decide to
    > put info in field 2 then field three calculates the total of field 1 and 2.
    >
    > I don't know if that makes any sence but I appreciate any help.


    As control source for Control3:
    =Nz([Field1]) + Nz([Field2])

    Note: this value should NOT be stored in any table.
    Whenever you need the result, simply re-calculate it, in a form,
    report, or query.
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail
     
  3. Chris

    Chris
    Expand Collapse
    Guest

    Try setting your field3 to the following expression:
    nz(field1)+nz(field2)

    the "nz" sets the fields to 0 if they are empty


    "Code Agent" <CodeAgent@discussions.microsoft.com> wrote in message
    news:BA4BCBDD-FF2D-42A5-96D4-043BF8CDF30A@microsoft.com...
    >I have 2 currency fields in a form. I also have another field that
    >calculates
    > the 2 when added. the problem I am having is if I dont put info in both
    > fields i cant get an amount in the third.
    >
    > ex. Field 1: = $25.00
    > Field 2 = $30.00
    > Field 3 = field 1 and 2 added which is $55.00
    >
    > I would like to be able to have the option of only entering in Field 1 and
    > have Field 3 = field 1 if there is nothing in field 2, but when I decide
    > to
    > put info in field 2 then field three calculates the total of field 1 and
    > 2.
    >
    > I don't know if that makes any sence but I appreciate any help.
     
  4. Code Agent

    Code Agent
    Expand Collapse
    Guest

    Thanks for your replies and correct answers. It works perfectly!

    "Chris" wrote:

    > Try setting your field3 to the following expression:
    > nz(field1)+nz(field2)
    >
    > the "nz" sets the fields to 0 if they are empty
    >
    >
    > "Code Agent" <CodeAgent@discussions.microsoft.com> wrote in message
    > news:BA4BCBDD-FF2D-42A5-96D4-043BF8CDF30A@microsoft.com...
    > >I have 2 currency fields in a form. I also have another field that
    > >calculates
    > > the 2 when added. the problem I am having is if I dont put info in both
    > > fields i cant get an amount in the third.
    > >
    > > ex. Field 1: = $25.00
    > > Field 2 = $30.00
    > > Field 3 = field 1 and 2 added which is $55.00
    > >
    > > I would like to be able to have the option of only entering in Field 1 and
    > > have Field 3 = field 1 if there is nothing in field 2, but when I decide
    > > to
    > > put info in field 2 then field three calculates the total of field 1 and
    > > 2.
    > >
    > > I don't know if that makes any sence but I appreciate any help.

    >
    >
    >
     
  5. Joseph Meehan

    Joseph Meehan
    Expand Collapse
    Guest

    Code Agent wrote:
    > I have 2 currency fields in a form. I also have another field that
    > calculates the 2 when added. the problem I am having is if I dont put
    > info in both fields i cant get an amount in the third.
    >
    > ex. Field 1: = $25.00
    > Field 2 = $30.00
    > Field 3 = field 1 and 2 added which is $55.00
    >
    > I would like to be able to have the option of only entering in Field
    > 1 and have Field 3 = field 1 if there is nothing in field 2, but when
    > I decide to put info in field 2 then field three calculates the total
    > of field 1 and 2.
    >
    > I don't know if that makes any sence but I appreciate any help.


    Are you sure you want to store that total in a field? Normally in
    Access you would not store it, rather you would compute it and display it as
    needed in a form, report or query.

    The problem would come up if one of the values were changed (corrected)
    the total would then be in error, also Access likes computing values better
    than looking them up. On the other hand if you want to retain the original
    total even if one of the components changes, then that should be stored; use
    the procedure someone has already provided.


    --
    Joseph Meehan

    Dia duit
     

Share This Page