Query to locate missing records

LSPM11

New Member
Joined
Nov 18, 2015
Messages
3
I am trying to setup a query that will return a list of gymnasts who have not turned in a permission slip for a given meet taking place within a given year. I created a query to return all gymnasts that are still active and want to compare the results of this query to the contents of a table that’s used to record the receipt of permission slips. I am new to Microsoft Access and do not know if this is even remotely close to the right approach, but I have included the SQL for what I attempted, which returns no results. I would appreciate any feedback on the best method for obtaining the desired data:

PARAMETERS [Enter Meet Name:] Text ( 255 ), [Enter the Year in which Competition Occurs:] Long;
SELECT qryActiveGymnasts.LastName, qryActiveGymnasts.FirstName, qryActiveGymnasts.Level, qryActiveGymnasts.EmailAddress, qryActiveGymnasts.HomePhone, qryActiveGymnasts.MobilePhone
FROM qryActiveGymnasts LEFT JOIN tblMeetAttendance ON qryActiveGymnasts.[ID] = tblMeetAttendance.[Gymnast]
WHERE (((tblMeetAttendance.Meet)=[Enter Meet Name:]) AND ((tblMeetAttendance.CompetitionYear)=[Enter the Year in which Competition Occurs:]) AND ((tblMeetAttendance.Gymnast) Is Null));
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Welcome to the Board!

You should be able to simply do an Unmatched Query between your two queries. There is actually a Query Wizard right in Access that will walk you through the steps of doing this.
 
Upvote 0
Thank you. I tried to create an unmatched query, but it returns an error message when I attempt to run it:
"This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables."
Access doesn't seem to like the fact that I'm assigning parameters to the table it's searching.
 
Upvote 0
I think the issue may be with your WHERE clause. You may be trying to do too much in one step.
Note the last clause:
Code:
[COLOR=#333333]AND ((tblMeetAttendance.Gymnast) Is Null))[/COLOR]
This is used in conjunction with the LEFT JOIN to only return records where there is no matching record in the "tblMeetAttendence" table.

However, in that same WHERE clause, you have other criteria like this, trying to limit your search to certain records, in that SAME table:
Code:
[COLOR=#333333]WHERE (((tblMeetAttendance.Meet)=[Enter Meet Name:]) AND ((tblMeetAttendance.CompetitionYear)=[Enter the Year in which Competition Occurs:]) [/COLOR]
So, I don't think you can check for records being there and not being there at the same time like that in a single step!

I think you may need to use Subquerys, to first select which records in the "tblMeetAttendence" table that meet your parameter criteria, and then use THAT resulting query in your Unmatched Query Wizard.

If you need help figuring that part out, let me know, and when I have some more time, I will try to recreate a database that mirrors yours to see if we can get that code for you.
 
Upvote 0
Thank you Joe! I will play around with that and see if I can figure it out. I very much appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,252
Members
451,757
Latest member
iours

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top