Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5987055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:45:35+00:00 2026-05-22T22:45:35+00:00

I am new to Access and am using Access 2007. I am doing a

  • 0

I am new to Access and am using Access 2007.

I am doing a simple query on a database that has a list of customers who visits a workshop.

I want to send out reminders to the customers for their servicing 3 months from the last time they visited. I have created a query to be able to return me the list of customers who has visited 3 months from the current month. For example, if it is May now, 3 months ago would be March (inclusive of May).

However, customers who visited 3 months ago may have visited again 2 months ago. For example, customer A came in March and April. His last visit was in April, and hence, should not appear in the result if I were to run the query in May, as his reminder should only be sent out in June.

My query has taken care of this, however, it is rather slow. It takes some time for it to load in Access. Any help would be appreciated in optimizing it.

The only important field here is Invoice.DebCode which is the customersID in the database. There is another table DEBTOR, which is the table of customers together with their particulars.

I used the INNER JOIN as I need to display the customer(Debtor) address and particulars in the result.

SELECT Invoice.InvNo, Invoice.InvDate, Invoice.DebCode, Debtor.DebName, Debtor.AddL1, Debtor.AddL2, Debtor.AddL3, Invoice.CarNo, Invoice.ChaNo, Invoice.ExcReason
  FROM Debtor 
  JOIN Invoice ON Debtor.DebCode = Invoice.DebCode
 WHERE Year(InvDate) = Year(Now())   
  AND Month(InvDate) = Month(Now()) - 2
  AND Invoice.DebCode NOT IN (SELECT Invoice.DebCode
                                FROM Invoice
                               WHERE Year(InvDate) = Year(Now()) 
  AND (   (Month(InvDate) = Month(Now()) -1) 
       OR (Month(InvDate) = Month(Now())) )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:45:36+00:00Added an answer on May 22, 2026 at 10:45 pm

    What about something like:

    SELECT a.debcode, a.debname, a.debstuff, b.most_recent AS last_over_three_months
    FROM debtor AS a INNER JOIN 
    (
    SELECT debcode, Max(invdate) AS most_recent
    FROM invoice
    GROUP BY debcode
    )
    as b 
    ON a.debcode= b.debcode
    WHERE (month(now()) - Month(most_recent) >2);
    

    You will have to tweak for your stuff, but the idea is a subquery that select the most recent customer visit and then selects from that only the records that meet your month criteria.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A new client of mine has a small VB/Access database application written in 2002
I am using Access 2007 and have some linked tables to a mySQL database.
I have the following problem in a Database using Access 2007 as front end
EDIT: the database is Access 2007 Hi, I'm new here and I need some
I'm relatively new in using Access. I'm creating a database for questions and answers.
I want to insert a new row into an Access database. I'm looking at
So I wrote a project-management program for a small business using Microsoft Access 2007.
I have a foxpro database that we are trying to write to using MS
So I have an access mdb file that was originally create using Access 2003/Office
I have an Access 2007 application (previously in Access 2003) that is running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.