Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Any MS Access gurus out there?

Thread Tools
 
Search this Thread
 
Old 10 September 2003, 10:20 AM
  #1  
Iain Young
Scooby Regular
Thread Starter
 
Iain Young's Avatar
 
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes on 0 Posts
Question

Hi folks, I've got a quick MS Access question and was wondering if anyone out there can point me in the right direction.

Basically I have two tables, Movies and Actors. In the Movies table there is a field called Actors which I want to populate with values from the Actors table. I can create a relationship ok for a single item (i.e each movie entry can have 1 actor), but what I actually want to do is to have the actors field contain multiple references to the actors table.

My first thought would be to create a relationships table which would list every movie to actor relationship, remove the actors field from the Movies table, and handle everything in the form. This should work ok but it seems a bit messy, so I was wondering if anyone had any other ideas of how I should approach this?

Thanks,
Iain
Old 10 September 2003, 10:29 AM
  #2  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

Common problem in referential databases.

To represent a many:many relationship you need to use a separate table to encapsulate the relatonships.

So if you've got

Table Movie: MovieID, Name, other guff.
Table Actor: ActorID, name, other guff...

you need at a minimum
Table MovieActor: MovieID,ActorID

In the movieactor table you put entries that show what actor is in what movie. You can give it a primary key, or you can use MovieID and ActorID as a composite key... Though that could create problems.

What you might want to do is have:

Table MovieActor: MAID, MovieID, ActorID, ActorRole

That would allow you to capture what role someone played in the movie, and also would allow you to store data when the same actor had two roles in a single movie.

Cheers,
Nick.
Old 10 September 2003, 10:30 AM
  #3  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

...you already knew that, didn't you? D'oh!

You may want to look at using subforms to capture the data. Use lists with a lookup on the actor table to capture the data into the subform...
Old 10 September 2003, 10:31 AM
  #4  
SJ_Skyline
Scooby Senior
 
SJ_Skyline's Avatar
 
Join Date: Apr 2002
Location: Limbo
Posts: 21,922
Likes: 0
Received 1 Like on 1 Post
Smile

Many to many relationships are BAD!!

you need something like the following:

tblMovies
- intMovieID
- strMovieName

tblMoviesJunctionActors
- intMovieID
- intActorID

tblActors
- intActorID
- strActorName

tblMovies has a 1 to many relationship with tblMoviesJunctionActors

tblActors has a 1 to many relationship with tblMoviesJunctionActors


hope this helps!

Rich
Old 10 September 2003, 10:35 AM
  #5  
Iain Young
Scooby Regular
Thread Starter
 
Iain Young's Avatar
 
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes on 0 Posts
Post

Thanks Nick.

I thought I'd end up having to do that, I just thought I'd check before getting started (I didn't know whether access had any fancy stuff to make this easier, as I've only used mysql up to now). I'll take a look at the subforms...

All this just to get my dvd collection list onto my Ipaq

Cheers,
Iain
Old 10 September 2003, 10:36 AM
  #6  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

just store the dvd title and have a big button that links to to IMDB.com
Old 10 September 2003, 10:36 AM
  #7  
Iain Young
Scooby Regular
Thread Starter
 
Iain Young's Avatar
 
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes on 0 Posts
Smile

Thanks Rich, that was the sort of thing I was thinking about.

I think I know what I'm going to do now....

Cheers,
Iain
Old 10 September 2003, 10:40 AM
  #8  
Iain Young
Scooby Regular
Thread Starter
 
Iain Young's Avatar
 
Join Date: Sep 1999
Location: Swindon, Wiltshire Xbox Gamertag: Gutgouger
Posts: 6,956
Likes: 0
Received 0 Likes on 0 Posts
Post

That's cheating

I would do it, but I can't link to the internet whilst standing in mvc / hmv wondering if I've already got that film / version of that film or not (I've got a few). Besides, I enjoy the challenge

Cheers,
Iain

Old 10 September 2003, 11:12 AM
  #9  
TopBanana
Scooby Regular
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

Yes, you need to use a third link table
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
TylerD529
General Technical
2
09 October 2015 01:53 AM
Littleted
Computer & Technology Related
4
25 September 2015 09:55 PM
Hangarrat93
Insurance
11
25 September 2015 08:42 AM
farmerwrx
Computer & Technology Related
14
10 September 2015 11:59 AM



Quick Reply: Any MS Access gurus out there?



All times are GMT +1. The time now is 11:40 AM.