incrementing a field value from another table entry

G

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

Joseph Meehan

Ladderman said:
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?
 
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