Results 1 to 5 of 5
  1. #1
    ELW is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    3

    Wink Running a Parameter Query

    Hello Everyone,



    I am attempting to run a parameter query on my movie database. I have one table that consists of:

    Auto Number Field
    DVD #
    Movie Title
    Lead Actor First Name
    Lead Actor Last Name
    Co-Star First Name
    Co-Star Last Name
    Year Released
    Length
    Size
    Category

    I have concatenated the Lead Actor First and Last Name fields as well as the Co-Stars First and Last Name Fields. As I am looking for information from both concatenated fields, I am using the OR operator.

    ISSUE: I want to be able to type in an actors name and pull up all of the movies in my collection that he appears in...whether he's the lead actor or the co-star.

    Example: I have seven movies that Jason Statham appears in. Six of the seven movies, he is the lead actor. The seventh movie, he is a co-star. When I run the query and type in Jason Statham, I only pull up three of the six movies that he appears in, and NOT the movie that he co-stars in. If I type only his first name, (Jason), I will pull up all seven movies and any movies that any other actor with the first name Jason appears in. Then I have to filter the query.

    I just want to be able to type an actors name and pull up all of the movies that they appear in. Any help you can provide would be greatly appreciated.

    Running: Windows 7 Professional and Access 2010 32-Bit. Thanks

    Here is the parameter query I have set up: DVD#, Lead Actor, Co-Star (both of these are concatenated fields), Movie Title, and Category.

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Here's my SQL:
    Code:
    SELECT [StarFName]+" "+[StarLName] AS Star, [CoStarFName]+" "+[CoStarLName] AS CoStar, Star_CoStar_Names.Movie
    FROM Star_CoStar_Names
    WHERE ((([StarFName]+" "+[StarLName])=[Starring])) OR ((([CoStarFName]+" "+[CoStarLName])=[Starring]));
    I created a query with two concatenated fields - Star, CoStar and then put [Starring] in the first Criteria row under 'Star' and also in the SECOND Criteria row of 'CoStar'.

    See attachment.

    I hope this helps!
    Attached Thumbnails Attached Thumbnails Star_CoStar.JPG  

  3. #3
    ELW is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    3
    I agree with your SQL code....but it doesn't work in my database. I am attaching the file (460 KB). Can you take a look and it and tell me what needs to be done so that it works?
    Attached Files Attached Files

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I only tried Jason Statham [I'm a fan! ].
    Also - I went directly to the Table rather than the query - but I don't think it matters which one you use.

    1. You have a Jason Stratham starring in 'Mechanic' [which I promised myself I wanted to see and haven't yet . . . ].
    2. I suspect something is going on with the DATA in one or more of your Star & CoStar FName & LName fields.

    When I put a Trim function on the data it works [extraneous invisible characters being removed from the text in those fields?].
    Code:
    SELECT Trim([StarFName])+" "+Trim([StarLName]) AS Star, Trim([CoStarFName])+" "+Trim([CoStarLName]) AS CoStar, Movies.MovieTitle
    FROM Movies
    WHERE (((Trim([StarFName])+" "+Trim([StarLName]))=[Starring])) OR (((Trim([CoStarFName])+" "+Trim([CoStarLName]))=[Starring]));
    Let me know if this works for you.
    All the best!

  5. #5
    ELW is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    3
    Thank you Robeen for your assistance. I think when I imported it from Excel, something went a little haywire. I did do a little tweaking with the names, and it does exactly what I wanted it to do, despite some of my friends stating otherwise. Thanks again for your help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query with a running sum
    By is49460 in forum Queries
    Replies: 3
    Last Post: 09-07-2013, 11:11 PM
  2. Running Parameter Requires Table ID# Not Field Name
    By gabrielnerf in forum Queries
    Replies: 3
    Last Post: 02-05-2012, 12:34 AM
  3. Running a query
    By scarlettera in forum Queries
    Replies: 3
    Last Post: 04-04-2011, 01:59 PM
  4. parse on the fly when running a query
    By johnmerlino in forum Queries
    Replies: 9
    Last Post: 11-19-2010, 10:18 PM
  5. Running parameter queries from VBA
    By John Southern in forum Programming
    Replies: 6
    Last Post: 03-25-2010, 10:24 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