Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tabel relationship-winners/loosers to players

Status
Not open for further replies.

markajem

Programmer
Dec 20, 2001
564
0
0
US
I have programming background - DEC Basic and understand how the databases function, just don't have much experience in actually creating databases in ACCESS.

My godson owns a retail store and he keeps track of games that are played in the store by people that compete in tournaments. I have offered to help him create a database with access where he can store the wins and looses of each player and sometimes the players will be the same and sometimes new players.

My challenge:
I have created a PLAYERS table. Simple, first and last names of players. Then a table which lists the fields of a WIN PLAYER, LOOSE PLAYER, WIN POINTS AND LOOSE POINTS AND DATE of GAME as fields. What I want to do is make sure that when he enters into the form for the win/loose data that he can select a player (that has been entered into the database for PLAYERS) which he can do but when he actually enters the statistics of the player as to whether he won or lost I want him to be able to have a drop down box with the players names from the PLAYERS table come up. This way he will select a pre-entered player from the drop down box. I have created the relationship but when I test the form and click on the drop down menu no names come up from the PLAYERS table. I wanted him to HAVE TO select from a list of players this way when he enters the player statistics only ones that are in the PLAYERS table will be available. If one is not then he has to use the PLAYERS form to enter the new player and then he can go to the STATISTICS table and enter the results of the tournament. Which will also prevent him from entering an existing name in several different ways. So if there is a name like "SAM SMITH" in the PLAYERS table and he goes to enter his stats in the STATS table he does not just type in "S SMITH" instead of the actual name. This way when I create the report for the statistics and it sorts by PLAYER'S NAME you won't have several different versions of the same player. I just can't get the players to come up in the field for players in the stats field form.

I hope I have explained this okay.

Thanks for your help
Mark
 
Simply orwellian, if you get my drift.

We (now) both a bit more than we want, and less than we need (hence the invocation of George's mantra ~~ less : more).

At least in many cases, the combo box would be populated from an SQL statement ("Select 'stuff' from players;") with 'stuff' being the fields of the table. (e.g. last name and first name -probably concatenated with a space between them). What we do not know, is how you are attempting to populate the combo/list box. We would also like to know wheather you have attempted to bind the cbo to a field from the recordsource, and some of the other properties. Lastly, this appears to be the proverbial "tip 'o the berg", so perhaps even a bit of an expansion on hte (technical) bio might help to understand where you are. How much of what 'modern' programming have you done? When was the last time you attempted to do something like this? ...

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Mark,

In addition to Michael's advice, think a bit about your table structure. It would probably be better to have all of the points stored in one field. You already have the information of winner/loser stored. If you put points in two fields you'll have a hard time summing, averaging, etc.

Also, if you really want to open this up, I might think about one table for the match and one table for the results.

tblMatch
========
MatchID (autonumber)
MatchDate


tblMatchResults
===============
MatchID
PlayerID
Win (yes/no field)
Points

This structure would make querying easier, and would store less redundant data.

Jeremy
=============
Jeremy Wallace
Designing and building Access databases since 1995.
 
Jeremy,
Thank you for your advise. It sounds good. Only have one problem. I have to be able to cross reference who played who in the game and assign the points to the winner and the looser. I set up separate tables as:

Table - playerlist
Fields
playername

Table - gameslist
Fields
gamename

Table - winnersstats
Fields
date
playername
points
gamename

Table - loosersstats
Fields
date
playername
points
gamename


 
Hmm. Not sure why I didn't get back to you earlier. Sorry for that.

In any case, you really should read up some on "data normalization". Do a google search. You have too many tables. Your winner and looser tables should be combined into one table. Then add a field that you'll use to indicate whether the person won or lost. You'll be able to do your cross-referencing using queries.

Also, don't use names as primary or secondary keys. Use autonumber fields instead. Your forms and reports don't ever have to display this autonumber field, but it will save you a lot of headache if you get away from using a free text field to link tables. =============
Jeremy Wallace
Designing and building Access databases since 1995.
 
Okay, thanks for the tips Jeremy

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top