Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16

    Find members who have yet to pay


    I have a members table and a payments table. The payments table consists of a record for every year the member has paid. I need to find the members who have yet to pay for 2024. So find the members who do not have a record in the payments table for 2024. The tables are linked via “memberid”.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Not much info to go on. The names of the tables and pertinent fields would give anyone something to start with. Or drag the tables into a query, join them on the proper fields if it doesn't happen automagically, add the fields to the query design grid that you want to see in the results and make sure the date field is one of them. If your date field data is a complete date (i.e. you haven't split dates into component parts) then in the date field criteria row try DatePart("yyyy","myDateFieldNameHere") = 2024
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Quote Originally Posted by Micron View Post
    Not much info to go on. The names of the tables and pertinent fields would give anyone something to start with. Or drag the tables into a query, join them on the proper fields if it doesn't happen automagically, add the fields to the query design grid that you want to see in the results and make sure the date field is one of them. If your date field data is a complete date (i.e. you haven't split dates into component parts) then in the date field criteria row try DatePart("yyyy","myDateFieldNameHere") = 2024
    that would show those that have a record in the payments table for 2024. I am trying to find those that don’t have a 2024 record.

    appreciate the help

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    There is a wizard for that I seem to recall?
    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

  5. #5
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    THe wizard only shows payment records that have no member associated with them. I guess I code always create some via code to loop through and find those name that don’t have a related record in payments. Then create a temp table with those names, but hoping for a simple query to do so.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by Oregoncoder View Post
    that would show those that have a record in the payments table for 2024. I am trying to find those that don’t have a 2024 record.
    appreciate the help
    Yes, I goofed on that. I do believe WGM is correct - there is a wizard for finding records that are not in a table (or query if need be). Also, if your table has the date field then wouldn't
    Is Null
    work in a query? That way you would also capture those who didn't pay for prior years as well.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Quote Originally Posted by Micron View Post
    Yes, I goofed on that. I do believe WGM is correct - there is a wizard for finding records that are not in a table (or query if need be). Also, if your table has the date field then wouldn't
    Is Null
    work in a query? That way you would also capture those who didn't pay for prior years as well.
    Click image for larger version. 

Name:	is Null.JPG 
Views:	35 
Size:	17.8 KB 
ID:	51211 THe wizard only shows payment records that have no member associated with them

    Click image for larger version. 

Name:	Find Missing.JPG 
Views:	35 
Size:	41.4 KB 
ID:	51212Click image for larger version. 

Name:	find missing 2.JPG 
Views:	36 
Size:	35.7 KB 
ID:	51213 This is a snap of my file structure. How would I find if I didnt have a record for the year 2024?

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I note you haven't taken the advice provided in your other thread about table and field names - using spaces and reserved words. Your payments table also appears not to have a primary key. You don't have to take the advice, but a) every time you ask a question, it will be pointed out and b) at some point it will come back to bite you with inexplicable errors. All of which will lose you time trying to resolve it.

    To answer your question, you need two queries, the first to find members who have paid

    Code:
    SELECT MemberID
    FROM Payments
    WHERE year =2024
    call that qryPaid

    Then a second query left joining the members to qryPaid to find those that haven't paid

    Code:
    SELECT MemberID
    FROM WWWRoster LEFT JOIN qryPaid ON WWWRoster.MemberID=qryPaid.MemberID
    WHERE qryPaid.MemberID is Null

  9. #9
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Quote Originally Posted by CJ_London View Post
    I note you haven't taken the advice provided in your other thread about table and field names - using spaces and reserved words. Your payments table also appears not to have a primary key. You don't have to take the advice, but a) every time you ask a question, it will be pointed out and b) at some point it will come back to bite you with inexplicable errors. All of which will lose you time trying to resolve it.

    To answer your question, you need two queries, the first to find members who have paid

    Code:
    SELECT MemberID
    FROM Payments
    WHERE year =2024
    call that qryPaid

    Then a second query left joining the members to qryPaid to find those that haven't paid

    Code:
    SELECT MemberID
    FROM WWWRoster LEFT JOIN qryPaid ON WWWRoster.MemberID=qryPaid.MemberID
    WHERE qryPaid.MemberID is Null
    Thanks again for your help. Tried a simple change of name to fullname and had about 20 queries/forms/reports to fix then. Not sure of a simpler method? Planned to come back to it.

  10. #10
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    THe wizard only shows payment records that have no member associated with them
    Why would you have payments not linked to a member?

    Surely if you created a query for 2024 payments and used that as the second source in the wizard, that would show you those who have not paid?

    Been a while since I used the wizards though, I admit.
    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

  11. #11
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Why would you have payments not linked to a member?
    I think it's the other way around. Members not linked to a payment.
    My first thoughts were you also need a way to exclude inactive members as they also would not have payments each year.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  12. #12
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Quote Originally Posted by moke123 View Post
    I think it's the other way around. Members not linked to a payment.
    My first thoughts were you also need a way to exclude inactive members as they also would not have payments each year.
    a payment is only entered when it is made for that member. I have over a hundred members who do not have a 2024 payment record. I suppose I could’ve mass uploaded a 2024 record for each member and then identify those that have a zero dollar amount associated with the payment record.

  13. #13
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by Oregoncoder View Post
    a payment is only entered when it is made for that member. I have over a hundred members who do not have a 2024 payment record. I suppose I could’ve mass uploaded a 2024 record for each member and then identify those that have a zero dollar amount associated with the payment record.
    Yes, you could have done that with a DatePaid = Null.

    So many ways to do a process in computer code. Up to you which is the best for you?
    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

  14. #14
    Join Date
    Apr 2017
    Posts
    1,680
    Your tables must be like:
    WWWRoster: MemberID, ForeName, LastName, ... (Leave FullName out of here!);
    Payments: PaymentID, MemberID, PaymentYear, PaymentAmount (No member names here!)

    To get the list of all members, not having paid in year 2024, the basic query will be like
    Code:
    SELECT mbr.MemberID, mbr.LastName & ", " & mbr.ForeName AS FullName 
    FROM WWWRoster mbr LEFT JOIN (SELECT pmt.PaymentID, pmt.MemberID,  FROM Payments pmt WHERE pmt.PaymentYear = 2024) pmt2024 ON pmt2024.MemberID = mbr.MemberID
    WHERW pmt2024.PaymentID Is Null
    Probably you have to check, is the member active for year 2024 too. When not, then obviously he/she didn't have to pay at all. So the table WWWRoster must have some field(s) allowing to decide about membership being active for certain year, or not.
    Another thing you have to take into account is, that person names aren't fixed really. Without them being put into some names history table, asking for info from past years you get person's current name, which can be different than real one in asked year. And when you then have to compare gotten data e.g. with some printed documents, you may be in trouble!

  15. #15
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    same suggestion as post #8

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

Similar Threads

  1. Replies: 4
    Last Post: 12-31-2020, 12:27 PM
  2. Are you coming / RSPV / members
    By SimplyBrass in forum Access
    Replies: 1
    Last Post: 03-17-2018, 11:02 AM
  3. All family members with one address
    By Grams in forum Access
    Replies: 5
    Last Post: 08-25-2014, 05:51 PM
  4. Replies: 24
    Last Post: 02-04-2014, 07:26 PM

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