Newbie Help on Football/Soccer Database

  • Thread starter Thread starter graeme5475
  • Start date Start date
G

graeme5475

Hi

I'm fairly new to access and have set up the structure of a database,
but want to know if there is a design flaw before i enter data for over
500+ football matches.

I am tracking over 13 years of matches for my favourite football club
[Newcastle Utd], I seem to have far too many tables and the
relationships window is an absolute nightmare.

I have managed to cobble together an match input form that records
everything I want it to (Oppositon, venue, date, 2 team lineups, whoc
scored who was subbed etc)and the relevant data is filtering through to
the relevant underlying tables.

However for choosing the team lineups I have 11 combo boxes which
eventually are going to be in excess of 2500 player entries. Am I
going to encounter problems in the future using this method?

Regards
Graeme
 
Hi

I'm fairly new to access and have set up the structure of a database,
but want to know if there is a design flaw before i enter data for over
500+ football matches.

I am tracking over 13 years of matches for my favourite football club
[Newcastle Utd], I seem to have far too many tables and the
relationships window is an absolute nightmare.

I have managed to cobble together an match input form that records
everything I want it to (Oppositon, venue, date, 2 team lineups, whoc
scored who was subbed etc)and the relevant data is filtering through to
the relevant underlying tables.

However for choosing the team lineups I have 11 combo boxes which
eventually are going to be in excess of 2500 player entries. Am I
going to encounter problems in the future using this method?

Regards
Graeme
It would be easiest if you posted the table names and relationships.
At a guess you should have the tables

Grounds
Clubs
Players - related to clubs
Season
Match - related to grounds, season, clubs as homeTeam, clubs as AwayTeam.
Team - related to match, player.
HTH
Marc
 
Hi Marc

I have most of the tables you have listed however, I have not related
all the players to clubs. I have only differentiated which ones have
played for Newcastle over the time period (1993 - current), so when I
choose the Newcastle side it's from this pool of players (approx 120)
and the oppostition is all players (approx 2500), once I have got the
db up to date I can filter out those platyer swho are no longer in the
premiership have retired etc. I have a field called current to allow
this?

I can send you the db zipped (~600k) if you would like to see how I
have set it up

Regards
Graeme
 
Hi Marc

I have most of the tables you have listed however, I have not related
all the players to clubs. I have only differentiated which ones have
played for Newcastle over the time period (1993 - current), so when I
choose the Newcastle side it's from this pool of players (approx 120)
and the oppostition is all players (approx 2500), once I have got the
db up to date I can filter out those platyer swho are no longer in the
premiership have retired etc. I have a field called current to allow
this?

I can send you the db zipped (~600k) if you would like to see how I
have set it up

Regards
Graeme
Hi Graeme

Yes, I can see the players are not always related to clubs and can move to
different clubs too :).

So possibly instead of putting club id onto the players table you need a
third table

player_club - playerid, clubid, effective date.

Your solution is probably fine, but it is possible as the db grows up, the
limits of that solution will show. Unless it is not going to grow up too
much ;)

Thanks for the offer of sending the db because I would love to look at it,
but in reality I don't have the time. Specific questions that I think I can
help with here are about all I do have time for here.

Thanks
Marc
 
Hope you don't mind an Evertonian jumping in here<G>.

You should not have multiple combo boxes for the line ups. Instead use two
identical subforms for home and opposition teams with just the one combo box.
These subforms would both be based on a separate MatchTeams table with
foreign key column such as MatchID referencing the same column in a Matches
Table (on which the main form would be based) and the LinkMasterFields and
LinkChildFields properties of the subform control would thus be MatchID. The
Home Team subform would have True as the default value for HomeTeam (or
whatever) Boolean (Yes/No) column in its underlying table and the Opposition
Team subform False as the default value of the same column.

With subforms like this you can enter as few or as many players per team per
match, so you can cater for however many substitutes are used. You could
even have a column in the table for the time they came on.

The RowSource of the combo boxes on the subforms can be tailored to list
specific players if you have the data in the Players table to do this. This
would require details (in a related table modelling the many-to-many
relationship between Players and Clubs) of the dates a player was on the
books of each club he'd played for so that he would be listed in the combo
box only if he was available on the match date.
 
Hi Ken

No problems taking advice of an Evertonian ;0)

I'm not totally sure of what you are getting at. I did initially use
the same subform that contained 11 combo boxes with one having the NUFC
field ticked for Newcastle line-up and the other not having it ticked
for the opposition line up. However when I went to form view it would
show newcastle line up for both teams. This was due to them both
having the same matchid and it was just displaying the first entry it
came to. I couldnt work out how to tell the form to display the other
line up for that match id.

Would it be possible to send you the db zipped for you to take a look
at? Its 600k zipped and has 10 matches in so far (incl Newcastle
beating Everton 1-0 in 1993/94 season ;op)

Cheers
Graeme
 
Before sending your file to me lets step back a bit and examine what's needed
here as I think you'll learn more if you implement it yourself than me doing
it for you.

Firstly the tables we are concerned with here are as follows (your table and
column (field) names may well differ, but hopefully you'll see what's
required).

a. Matches: This has one row per match and its primary key is MatchID.
b. Players: This has one row per player with a primary key PlayerID and
will have columns for the player's name etc.
c. MatchTeams: This has one row for every Match/Player with two foreign
key columns MatchID and PlayerID. In combination the values in each row for
these two columns must be unique, so the two columns together can be the
table's primary key. This table would also have any columns you'd want to
record other attributes of the player's part in this match, e.g. the time he
came on the pitch if a substitute), his position etc.

There will be other tables for Teams, Venues etc of course, but we don't
need to concern ourselves with those for the moment as its how to record the
teams per match which we are looking at.

The main (parent) form will be based on the Matches table and will be where
the data for each match is entered. In fact you'd most probably base it on a
query sorted by MatchDate so the form's records appear in the correct order.
This will be in single form view.

To record the teams for each match you need two subforms in this form. More
accurately you need two subform controls as the underlying form object for
each will be the same, so the first task is to design this form.

The subform will be based on the MatchTeams table and should be in
continuous form view (you can use datasheet view and save yourself some work,
but it looks less professional, so I never do). The form should have
controls bound to all the columns in the table apart from the MatchID and
NUFC columns as the value for these column will be automatically entered by
virtue of the link to the parent form (more of this later). Design the form
so that the column names are in the form header in a single line and all the
controls are in a single line in the detail section. Make the height of the
detail section just big enough to hold the line of controls, i.e. you don't
want any empty space below or above them in the section. To select a player
you'd use a combo box with PlayerID as its ControlSource and a RowSource
which lists the Players. You only want to see there names however, not the
PlayerID value, so the first (bound) column of the list should be hidden.
The combo box wizard can set this up for you, but if you have any problems
post back here. For the moment lets leave this to list all players in the
database; we can com back to limiting the list to only those available for
the current teams/match later.

Having designed this subform, go back to the main matches form and add two
subform controls and size them so they'll each hold the subform you've just
designed and be deep enough to show at least 11 rows in each.

In each of these subform controls select the subform you've just created as
the control's SourceObject property. You'll probably find that Access
automatically inserts MatchID as the LinkChildFields and LinkMasterFields
properties. When you open the form at this stage you'll see all players
you've entered for this match in both subforms, whereas you want to see the
two team lists separately in each. To do this you need to use a bit of
trickery as follows:

The first thing you need to do is add two hidden text boxes to the main
parent form (as they'll be hidden you can put them anywhere on the form).
Set the Name properties to txtTrue and txtFalse, set their ControlSource
properties to =True and =False and set their Visible properties to False (No
in the properties sheet).

The next thing you need to do is amend the LinkChildFiels and
LinkMasterFields properties of the two subform controls. For the Newcastle
subform change them to MatchID;txtTrue for the LinkMasterFields and
MatchID;NUFC for the LinkChildFields. For the opposition's subform change
them to MatchID;txtFalse for the LinkMasterFields and MatchID;NUFC for the
LinkChildFields. I'm assuming that NUFC is a Boolean (Yes/No) column in the
table.

You should now find that the subforms will show the Newcastle and opposition
teams for each match separately in each subform, and when you add a new
player record in the subform the NUFC field will be automatically set to True
or false as appropriate. This is because the two hidden text boxes on the
parent form are acting in the same way as if they were fields in the parent
form's underlying recordset. To use references to controls like this in the
linking properties of a subform you have to eneter their names directly in
the properties sheet, however; you can't do it via the dialogue which open
when you click the build button (the one wuth 3 dots) for the properties.

I think the above should enable you to set up the basic form/subform.
There's other functionality which can be added, but lets not get too far
ahead of ourselves right now (or we'll be flagged off-side!)

I've answered this at some length because it’s an interesting problem and
rather than your sending me your file what I'd like to do, if you are
agreeable, is put together a little demo file which one of my contacts, who
writes for a computer magazine here in the UK, might be interested in putting
in his column (he's not usually averse to getting paid for my work!). I'll
mail you the file directly once I've got it set up – I think I'll base it
Everton, though, not Newcastle United, and maybe put in Liverpool and Man U
to provide some easy opposition<G>.
 
Hi Ken

I have implemented your suggestions and now have a match entry form to
capture lineups, subs, goalscorers etc. I have 2 issues that I am stuck
on that would speed up data entry

1. As there is initially only one combo pox this is defaulted to
position 1, when I add the other 10 players I have to manually change
their position to 2-11 respectively. Is there a way that Access can
automatically increment these by 1. Then when I go to a new match its
back at 1 again etc?

2. I currently have 2 buttons on the main match form to open seperate
forms 'Add Club' and 'Add Personnel'. These are if I come across a
player or club I have yet to enter the database. However once I have
added the club, I need to shut down the main match form and re-open it
for that club to appear in the combo box. I did stick a requery event
on the GetFocus property of the club combo box which worked. I was
wondering though is there a way of adding somethis to the OnExit
property of the Add Club/Add Personnel that automatically requeries the
entire form, rather than me sticking individual macros on each combo
box.

Once I have it up and running I have no problem in sending you a demo
file, I'm sure you will be able to see how to make it more
efficient/streamlined etc

Cheers
Graeme

p.s Good luck tonight for Villareal!!
 
To increment the Position field's value you can look up the highest value for
the match/team in question and add 1. I'd do it in the AfterUpdate event
procedure of the combo box on the subform with:

Dim strCriteria As String

If Me.NewRecord Then
strCriteria = "MatchID = " & Me.MatchID & _
"And NUFC = " & Me.NUFC
Me.Position = DMax("Position", "MatchTeams", strCriteria) + 1
End If

This will add 1 to whatever the highest position number in the subform was,
so if you delete a player and enter a replacement (if you'd entered the wrong
player accidentally say) it would not fill in the gap if the position you
deleted wasn't the highest number. You can edit the value manually to get
the sequence back on track, however.

To add a new club or player the best thing would be to open the form in
dialog mode. This causes the calling code to pause its execution until the
other form is closed, so you can then requery the combo box in the code as
this line won't execute until you've closed the other form, e.g.

DoCmd.OpenForm "frmClubs",DataMode:=acFormAdd,WindowMode:=acDialog
Me.cboClubs.Requery
 

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

Back
Top