473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Access date/time range query

I need to query an Access database via VB and get a count of all the
calls where the start time is between a 2 certain days/times.

For example, all the calls that occurred from Saturday @ 8am to Monday
@ 8am. It needs to be for saturdays - mondays, not just a certain
weekend. Anyone have any clues how to do this?

I have the weekday part down, I am just stumped on how to handle the
time range.
SELECT COUNT(call_id) FROM calls WHERE (weekday(start) >= 7 OR
weekday(start) <=2)

I am not sure how to tie the time range in.

I would appreciate any feedback. Thanks!

Nov 13 '05 #1
3 4031
Try:
WHERE WeekDay(DateAdd("h", -8, [start])) IN (7,1,2)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Kristen" <kw*****@synergysw.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I need to query an Access database via VB and get a count of all the
calls where the start time is between a 2 certain days/times.

For example, all the calls that occurred from Saturday @ 8am to Monday
@ 8am. It needs to be for saturdays - mondays, not just a certain
weekend. Anyone have any clues how to do this?

I have the weekday part down, I am just stumped on how to handle the
time range.
SELECT COUNT(call_id) FROM calls WHERE (weekday(start) >= 7 OR
weekday(start) <=2)

I am not sure how to tie the time range in.

I would appreciate any feedback. Thanks!

Nov 13 '05 #2
That worked! Thanks. But I am allowing my software users to inut their
own weekdays & times. So I'm still confused about what to do if they
put in different times.

Like say they choose Saturday 10am - Monday 7am?

Thanks!

Nov 13 '05 #3
Hi Kristen

You will need to use a combination of Weekday() and TimeValue(), e.g.:

(Weekday([start]) = 7) AND TimeValue([Start]) > #10:00:00#) OR
(Weekday(...

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Kristen" <kw*****@synergysw.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
That worked! Thanks. But I am allowing my software users to inut their
own weekdays & times. So I'm still confused about what to do if they
put in different times.

Like say they choose Saturday 10am - Monday 7am?

Thanks!

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ImraneA | last post by:
Hi there Many thanks to those people who contributed to this group, helped me greatly. Enclose, my code, hope it helps others :- Public Function Export_Excel_9(tbx1 As Variant, tbx2 As...
4
by: jwa6 | last post by:
I have a user/pc specific problem in access. This doesn't occur on any other ( windows xp pc) that I have used the ..mbd on. This involves a query that's using a range of dates as a parm. This...
67
by: PC Datasheet | last post by:
Transaction data is given with date ranges: Beginning End 4/1/06 4/4/06 4/7/06 4/11/06 4/14/06 4/17/06 4/18/06 4/21/06 426/06 ...
1
by: isetea | last post by:
Hi, I want to create a from where user can select from a date range / type in a date range to get only data from an underlying query within this range. This should overwrite the existing criteria...
3
by: stuart.medlin | last post by:
I have an Access 97 application that has a basic form (Transcript) and subform. The subform has a query as a recordsource that returns records from a table: SELECT DISTINCTROW Transcript.NCID,...
3
by: keithsimpson3973 | last post by:
I am trying to find a way to do the following I need to make a report (or datagrid, not sure which would be better) that can be printed. The format of the report is as follows: The first column...
14
by: awayne | last post by:
I am working with MS VB 6.5. I am putting together a MS Access (MS Access 2000) database for work to keep track of the projects and their status that we've done. I use MS Access to run a "Make-table...
1
by: wetsprockets | last post by:
Hello, I have two tables, WindVector (wind data) and DOH_FC88to07 (water quality samples). The WindVector table has the following fields: Date (short date) Time (short time) WindSpeed...
8
by: Killer42 | last post by:
Hi all. I have an interesting situation; searching a Date field for my exact value fails, but including it in a range works. I know this sounds like the usual beginner's date/time woes but I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.