Results 1 to 10 of 10
  1. #1
    dmelsass is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    8

    Setting Criteria for one of 3 related fields

    Hello, bare with me. I am making a database for tracking weight lifting events.



    I have Two Tables:
    - Lifter (stores lifter's name, Gender, country)
    - Event (stores specifics about event including lifterID, date, amount of lifts, etc.)

    I related the lifter's Auto ID # and made one of the fields in the Event form a lookup field that includes 3 identifiers from my lifter table (lifterID, Name, gender)

    I want to create two queries that shows one as all the male lifters and the other for female lifters.

    However when I create the query the criteria will not filter male or female because the field is defined by the lifter's ID number.

    I can create the query to display the lifterID field as male or female but it still will not let me criteria the data to female or male because it is related by the ID number and causes a criteria error. I have to manually filter the data each time I run the query instead of the query doing it automatically.

    Anyone know a solution?

    I attached some photos to hopefully help..

    Sent from my SM-G935V using Tapatalk

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Instead of doing Filters, since you are doing Queries, simply join the two Tables in your Query, and use Query Criteria on the Gender field to return what you want.

  3. #3
    dmelsass is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    8
    I really feel dumb at this point. I was figuring by adding the two tables into the query separately I would get multiple duplicate records because the lifterID loops back to lifter.

    I feel like an idiot.. Thanks for the help.

    Sent from my SM-G935V using Tapatalk

  4. #4
    dmelsass is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    8
    Well I do get multiple duplicate fields but I can filter that out when I get to forms and records...

    Sent from my SM-G935V using Tapatalk

  5. #5
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You do not need to add ALL fields from both table to your Query. You can pick and choose exactly which fields you want to return.
    And you can even apply criteria to fields which you are not showing in the Query (just uncheck the "Show" box under the field).

  6. #6
    dmelsass is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    8
    Quote Originally Posted by JoeM View Post
    You do not need to add ALL fields from both table to your Query. You can pick and choose exactly which fields you want to return.
    And you can even apply criteria to fields which you are not showing in the Query (just uncheck the "Show" box under the field).
    I understand that, but my event table pushes me toward that 20 field cap if I do not run it astericked to include all fields.

    Everything I need listed I believe is in total 24 fields..

    Sent from my SM-G935V using Tapatalk

  7. #7
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You can do an asterisk from one table and not the other.

    I don't think there is 20 field cap (I have added many more in the past). That might just be what it shows by default. Click on the "Insert Columns" button on the Query Setup ribbon to add more.

  8. #8
    dmelsass is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    8
    Quote Originally Posted by JoeM View Post
    You can do an asterisk from one table and not the other.

    I don't think there is 20 field cap (I have added many more in the past). That might just be what it shows by default. Click on the "Insert Columns" button on the Query Setup ribbon to add more.
    I will try that. Thanks for the help.

    Sent from my SM-G935V using Tapatalk

  9. #9
    dmelsass is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    8
    Quote Originally Posted by dmelsass View Post
    I will try that. Thanks for the help.

    Sent from my SM-G935V using Tapatalk
    I think it was a 20 field cap for the wizard. Manual was able to tweek and works great.

    Thanks again!

    Sent from my SM-G935V using Tapatalk

  10. #10
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You are welcome!
    Yes, the Wizards can be a bit limiting (like only allowing you to join two tables or join on one field).
    So if you use them, you may sometimes need to manually update the query after it has been created.

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

Similar Threads

  1. Setting Query Criteria using Iif Statement
    By thexxvi in forum Access
    Replies: 7
    Last Post: 12-14-2015, 01:27 PM
  2. Replies: 2
    Last Post: 11-03-2015, 08:56 AM
  3. Replies: 2
    Last Post: 10-19-2012, 01:44 AM
  4. Setting Criteria with a Lookup Field
    By winteram in forum Queries
    Replies: 1
    Last Post: 08-16-2011, 09:44 AM
  5. Setting criteria in a calculated date field
    By SteveReberger in forum Access
    Replies: 0
    Last Post: 10-29-2008, 06:58 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