Welcome to SPN

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

Sign Up Now!

incrementing a field value from another table entry

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

  1. Ladderman

    Ladderman
    Expand Collapse
    Guest

    I have a Database table called 'Players', with fields called: Name, Played
    and Won. There are others, which are not important to this problem.

    I am also putting in results into a table called 'Results'

    The results will alway be 1-0 or 0-1. I am entering them on a 'Form' like
    this:

    Joe Bloggs 1
    Fred Smith 0

    They end up in the table as:

    Joe Bloggs 1 Fred Smith 0

    Which is fine.

    When these results are entered, I want the 1s and zeros to increment the
    'Played' field in a players record by one, and the 1s to increment the 'Won'
    fields also by one.

    It seems to me that this should be a simple excercise, but as I know nothing
    about Access, I am baffled.
     
  2. Loading...


  3. Joseph Meehan

    Joseph Meehan
    Expand Collapse
    Guest

    Ladderman wrote:
    > I have a Database table called 'Players', with fields called: Name,
    > Played and Won. There are others, which are not important to this
    > problem.
    >
    > I am also putting in results into a table called 'Results'
    >
    > The results will alway be 1-0 or 0-1. I am entering them on a 'Form'
    > like this:
    >
    > Joe Bloggs 1
    > Fred Smith 0
    >
    > They end up in the table as:
    >
    > Joe Bloggs 1 Fred Smith 0
    >
    > Which is fine.
    >
    > When these results are entered, I want the 1s and zeros to increment
    > the 'Played' field in a players record by one, and the 1s to
    > increment the 'Won' fields also by one.
    >
    > It seems to me that this should be a simple excercise, but as I know
    > nothing about Access, I am baffled.


    I am not at all sure I understand what you want to do.

    You have data consisting of a name and a "number"

    Will each name have one and only one number associated with it at any
    time. That is Joe Bloggs will always have a 0 or a 1 but never two 0's or 2
    1's or an 0 and a 1?

    You want to be able to change the 0 to a 1 and or a 1 to a 0 based on
    some event? Do you get a list of names which will require a change? What
    triggers the change?

    --
    Joseph Meehan

    Dia duit
     
  4. hippomedon@googlemail.com

    hippomedon@googlemail.com
    Expand Collapse
    Guest

    It seems to me that you should not be recording the total wins and
    played into the table "Players". It seems that this info should be
    pulled from the table "Results" and posted into your form/ report via a
    query or a domain function. For instance if the Results table had the
    following three fields: GameID, Winner, Loser. You could do the
    following in the report:
    PlayerName, Wins = DCount([Winner], "tblResults", "[Winner] =
    [PlayerName]"), Likewise Losses would be DCount([Loser], "tblResults",
    "[Loser] = [PlayerName]"), and total games played should be these two
    functions added together.

    Take care,
    Paul
     
  5. hippomedon@googlemail.com

    hippomedon@googlemail.com
    Expand Collapse
    Guest

    It seems to me that you should not be recording the total wins and
    played into the table "Players". It seems that this info should be
    pulled from the table "Results" and posted into your form/ report via a
    query or a domain function. For instance if the Results table had the
    following three fields: GameID, Winner, Loser. You could do the
    following in the report:
    PlayerName, Wins = DCount([Winner], "tblResults", "[Winner] =
    [PlayerName]"), Likewise Losses would be DCount([Loser], "tblResults",
    "[Loser] = [PlayerName]"), and total games played should be these two
    functions added together.

    Take care,
    Paul
     

Share This Page