Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250

    Using the update query will only allow you one actor per movie....
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  2. #17
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,422
    Quote Originally Posted by tatihulot View Post
    I assume if I want to use this SQL for other actors, all I have to do is make sure those movies are at the end of the list, change the ID number in the SQL range code, and then change the Actor ID. I'll try it.
    You could, or if there are not too many updates to do at once, then you might want to try an IN clause: WHERE Movie.MoviePK IN(66552, 66557, 665560, 665565)
    As I first said, you shouldn't be having this issue because this should be taken care of via forms at the point of movie record creation. If you need to edit the related record and add actors, your form should take care of that. Not only that, so far, your join table is being used to relate one actor to many movies when in reality, many movies also have many actors. If you have to do this for 5, 6, whatever, more actors for the same movie that's going to get interesting.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #18
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    frmAddActor in the file I uploaded would allow you to filter by director, country, etc. and\or manually select movies in which the selected actor has played. It will then append the records to the Actor_Join table so you can have multiple actors per movie (not saying the one-actor movies are boring but ...).
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  4. #19
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    565
    bulk-adding like you're describing might not be a great idea... I'm not sure how to do it where it's easy to select the movies that would make it any more efficient than entering the movies from a combobox in a subform. Since there are LOTS of Actors and LOTS of Movies, selecting which actors appear in which movies isn't going to be automatable (is that even a word?) the way I think you want to.

    I think the best you can do is to have a list of movie titles (well, you might need something like [Movie Title] & " (" & [Release Year] & ")" so you can see which release of the movie you're selecting.). I would use a combobox in the subform to show either the Movies or Actors and then just make the primary key of the "AppearsIn" table be (MovieID, ActorID). Say you are in the Movies main form and have an "Acts In" subform. You'd just have a combobox in the subform to select the actors. (Save ActorID, but show Actor name in the combobox).


  5. #20
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,555
    Quote Originally Posted by Welshgasman View Post
    You use an update query. Not an Append query, that adds extra records.
    First create a select query to get and check the records that should be updated.
    Then change to an Update query and select the ID of that actor.
    However after further thought, you would likely need a junction table to link Actors with Movies, so yes, that would then be an Append query with the relevant PKs of the other tables.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #21
    tatihulot is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    100
    Placeholder, please ignore this post.

  7. #22
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,555
    That is because it is an Update query and Updates the fields. The clue is in the name.

    As I came back and stated, if you have an ActorMovie junction table, then you would be appending records.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #23
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Or if you would have seen my post #16....
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  9. #24
    madpiet is offline Expert
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    565
    First off, since many actors can perform in many movies, and many movies can have at least some of the same actors, you need a bridge table between the Movies table and the Actors table. The table would be like this:

    CREATE TABLE MovieActor (MovieID INT, ActorID INT PRIMARY KEY (MovieID, ActorID)
    FOREIGN KEY MovieID REFERENCES Movie(MovieID), FOREIGN KEY ActorID REFERENCES Actor(ActorID) )

    The bridge table is the one you would use to base the subform on. So the whole "modify Movie table" part is a red herring. If you wanted to do something like show a comma-separated list of actors in a movie, you'd use a query for that anyway and base the form on that.

  10. #25
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    He already has that table (called Actor_Join) as described even in the post's title...
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  11. #26
    tatihulot is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    100
    Fixed the Update query to append actors into the Actor_Join field.

    INSERT INTO Actor_Join (ActorFK, MovieFK)
    SELECT 16, Movie.MoviePK
    FROM Movie
    WHERE Movie.MoviePK BETWEEN 1875 AND 1884;

  12. #27
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,555
    No longer an Update query. Get the terminology correct.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  13. #28
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Did you look at the file I gave you in post #12? What is wrong with the frmAddActor? You can even modify that to allow you to add batches of genre and location to their respective join tables for the selected movies. And no messing around with the append query hardcoding values...
    To each their own I guess.....
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  14. #29
    tatihulot is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    100
    Quote Originally Posted by Gicu View Post
    Did you look at the file I gave you in post #12? What is wrong with the frmAddActor? You can even modify that to allow you to add batches of genre and location to their respective join tables for the selected movies. And no messing around with the append query hardcoding values...
    To each their own I guess.....
    My apologies. I'll give it a closer look.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 10-05-2024, 04:23 AM
  2. Replies: 4
    Last Post: 07-16-2021, 11:36 AM
  3. Replies: 17
    Last Post: 01-19-2021, 08:07 AM
  4. Replies: 6
    Last Post: 10-19-2016, 03:40 AM
  5. Replies: 1
    Last Post: 09-07-2015, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums