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

  • Home
  • SEARCH
  • 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 1111075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:29:28+00:00 2026-05-17T02:29:28+00:00

I am writing my first little Access 2003 application. I have two queries that

  • 0

I am writing my first little Access 2003 application. I have two queries that I cannot figure out how to combine. What I am looking for is to get all the routes numbers in a date range, count the total rows per route in the date range, and count how many were late. I have these two queries that get me part of the way there, just can’t figure out how to combine them in an Access query.

PARAMETERS StartDate DateTime, EndDate DateTime;
SELECT [ROUTE #], Count(*) AS Total
FROM [On time performace audits] 
WHERE ((([On time performace audits].DATE) Between [StartDate] And [EndDate]))
GROUP BY [Route #];

PARAMETERS StartDate DateTime, EndDate DateTime;
SELECT [Route #], Count(*) as Late
FROM [On time performace audits]
WHERE ([On time performace audits].DATE Between [StartDate] And [EndDate]) AND (    Minute( [ACTUAL TIME]- [SCHEDULED TIME]) >=6)
GROUP BY [Route #];

I’m not much of a SQL guy, more of a LINQ guy, and writing a quick and dirty app in Access 2003 after being used to VS2010 is a bit painful. Anyways, hope you can help.
Thanks.

  • 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-17T02:29:28+00:00Added an answer on May 17, 2026 at 2:29 am

    In your second example query, are you certain you want the Minute() function?

    If you want a duration between 2 date/time values, use the DateDiff() function.

    Debug.Print DateDiff("n", #2010/09/27 01:00#, #2010/09/27 02:10#)
    70
    
    Debug.Print Minute(#2010/09/27 02:10# - #2010/09/27 01:00#)
    10
    

    If the DateDiff() approach is what you want, try this:

    PARAMETERS StartDate DateTime, EndDate DateTime;
    SELECT t.[ROUTE #], t.Total, l.Late
    FROM
        (SELECT [ROUTE #], Count(*) AS Total
        FROM [On time performace audits]
        WHERE ((([DATE]) Between [StartDate] And [EndDate]))
        GROUP BY [ROUTE #]) AS t
        LEFT JOIN (
            SELECT [ROUTE #], Count(*) AS Late
            FROM [On time performace audits]
            WHERE ((([DATE]) Between [StartDate] And [EndDate]))
                And DateDiff("n",[SCHEDULED TIME],[ACTUAL TIME]) >= 6
            GROUP BY [ROUTE #]
            ) AS l
        ON t.[ROUTE #] = l.[ROUTE #];
    

    Note I enclosed the DATE field name with square brackets to distinguish it from the VBA Date() function.

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

Sidebar

Related Questions

I'm writing a little application and have fallen at the first hurdle nearly! I
Writing my first Linq application, and I'm trying to find the best way to
I'm writing my first Perl app -- an AOL Instant Messenger bot that talks
I'm writing my first iPhone app, so I haven't gotten around to figuring out
I am writing my first project that will use autoconf and teaching it to
I'm writing my first PHP app that has to directly deal with dates, and
It's not that I don't have access to javascript, of course. In most of
I am writing two console applications, a client and a server. I'm a little
I'm writing a little program that basically has a bunch of buttons that when
I wrote this little function for writing out HTML tags: def html_tag(tag, content=None, close=True,

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.