incrementing a field value from another table entry

L

Ladderman

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.
 
H

hippomedon

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
 
H

hippomedon

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top