473,396 Members | 2,093 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,396 software developers and data experts.

Date Functions in Access 2000

Hi Guys

I have recently been learning SQL from a book whose examples used the
Oracle engine. I have now made an Access database containing
information for English Football fixtures. I am using ASP pages and
ADO to access and query this database for information.

One piece of information I want to retrieve is a list of all the
football fixtures for the current week - that is, all the fixtures
from the current day until the next Sunday - the final day in this
week. For instance, if the query was run today, it would return
tonight's fixtures, as well as those for tomorrow (Friday), Saturday
and Sunday. If the query was run on Saturday, the 4th of October that
is, it would just return Saturday and Sunday's fixtures, which would
take it to the end of this current week.

I am using Microsoft Jet to parse the queries and was originally going
to use the NEXT_DAY Oracle function which took a date and a day and
would return the date of the next occurrence of the day specified, for
instance:

NEXT_DAY (#01/10/2003#, "Sunday") would return 05/10/2003, as this is
date of the next Sunday that occurs after the date supplied.

There doesn't seem to be an equivalent function in Access, so I was
wondering if anybody knew how I might be able to perform a similar
sort of query without the use of the NEXT_DAY function.

Cheers

Craig
Nov 12 '05 #1
3 11317
You could use something like this:

Put it into a standard module.

Use vbSunday, vbMonday etc...

Regards

Peter Russell
Function nextday(Vdate, vDay)
'Gets the date of the next occurrence of the given day
' usage: mydate = nextday("01-oct-03",vbwednesday)
'Same day assumes this day next week

Dim b

If Not IsDate(Vdate) Or vDay > 7 Or vDay < 1 Then Exit Function

b = Weekday(Vdate) - vDay

If b < 0 Then
nextday = CDate(Vdate) - b
Else
nextday = CDate(Vdate) - b + 7
End If

End Function
Craig Bates previously wrote:
Hi Guys

I have recently been learning SQL from a book whose examples used the
Oracle engine. I have now made an Access database containing
information for English Football fixtures. I am using ASP pages and
ADO to access and query this database for information.

One piece of information I want to retrieve is a list of all the
football fixtures for the current week - that is, all the fixtures
from the current day until the next Sunday - the final day in this
week. For instance, if the query was run today, it would return
tonight's fixtures, as well as those for tomorrow (Friday), Saturday
and Sunday. If the query was run on Saturday, the 4th of October that
is, it would just return Saturday and Sunday's fixtures, which would
take it to the end of this current week.

I am using Microsoft Jet to parse the queries and was originally going
to use the NEXT_DAY Oracle function which took a date and a day and
would return the date of the next occurrence of the day specified, for
instance:

NEXT_DAY (#01/10/2003#, "Sunday") would return 05/10/2003, as this is
date of the next Sunday that occurs after the date supplied.

There doesn't seem to be an equivalent function in Access, so I was
wondering if anybody knew how I might be able to perform a similar
sort of query without the use of the NEXT_DAY function.

Cheers

Craig


Nov 12 '05 #2
On 2 Oct 2003 06:48:05 -0700, cr*********@hotmail.com (Craig Bates)
wrote:

DateAdd is a close cousin.
-Tom.

Hi Guys

I have recently been learning SQL from a book whose examples used the
Oracle engine. I have now made an Access database containing
information for English Football fixtures. I am using ASP pages and
ADO to access and query this database for information.

One piece of information I want to retrieve is a list of all the
football fixtures for the current week - that is, all the fixtures
from the current day until the next Sunday - the final day in this
week. For instance, if the query was run today, it would return
tonight's fixtures, as well as those for tomorrow (Friday), Saturday
and Sunday. If the query was run on Saturday, the 4th of October that
is, it would just return Saturday and Sunday's fixtures, which would
take it to the end of this current week.

I am using Microsoft Jet to parse the queries and was originally going
to use the NEXT_DAY Oracle function which took a date and a day and
would return the date of the next occurrence of the day specified, for
instance:

NEXT_DAY (#01/10/2003#, "Sunday") would return 05/10/2003, as this is
date of the next Sunday that occurs after the date supplied.

There doesn't seem to be an equivalent function in Access, so I was
wondering if anybody knew how I might be able to perform a similar
sort of query without the use of the NEXT_DAY function.

Cheers

Craig


Nov 12 '05 #3
Craig,
Look up the WeekDay() function in VBA help:

As query criteria use:

Between Date() And (Date()+7-Weekday(Date(),2))

Note that while Sunday is normally considered the 1st day of the week,
in your case it is the last day of the week, so the weekday function
must show Monday (2) as the first day of the week.

Hope this is helpful.

--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
"Craig Bates" <cr*********@hotmail.com> wrote in message
news:a0**************************@posting.google.c om...
Hi Guys

I have recently been learning SQL from a book whose examples used the
Oracle engine. I have now made an Access database containing
information for English Football fixtures. I am using ASP pages and
ADO to access and query this database for information.

One piece of information I want to retrieve is a list of all the
football fixtures for the current week - that is, all the fixtures
from the current day until the next Sunday - the final day in this
week. For instance, if the query was run today, it would return
tonight's fixtures, as well as those for tomorrow (Friday), Saturday
and Sunday. If the query was run on Saturday, the 4th of October that
is, it would just return Saturday and Sunday's fixtures, which would
take it to the end of this current week.

I am using Microsoft Jet to parse the queries and was originally going
to use the NEXT_DAY Oracle function which took a date and a day and
would return the date of the next occurrence of the day specified, for
instance:

NEXT_DAY (#01/10/2003#, "Sunday") would return 05/10/2003, as this is
date of the next Sunday that occurs after the date supplied.

There doesn't seem to be an equivalent function in Access, so I was
wondering if anybody knew how I might be able to perform a similar
sort of query without the use of the NEXT_DAY function.

Cheers

Craig

Nov 12 '05 #4

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

Similar topics

3
by: Jay | last post by:
I previously posted this question under Visual Basic newsgroup, but was advised to re-post here. I'm hoping someone can help me solve an issue I'm having with VB.Net and Access 2000. Here's...
1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
1
by: sylvian stone | last post by:
Hi, I've used standard date functions in the past, but need to create something a little different, as I am working on an investment calculator. What I need to do is validate two dates, and...
3
by: Lyn | last post by:
Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
5
by: Easystart | last post by:
Hi, Sorry for my English. English is not my native tougue. I am working in MS Access 2000 with a SQLServer 2000 Backend database. MS Access 2000 is my GUI front end that has SQLServer linked...
1
by: Paul Brady | last post by:
In a self-contained database, the following query works fine and returns courses taken on 3/8/2000: ---------- SELECT TransactionCourses.CourseID, TransactionCourses.MbrID,...
5
by: TAG | last post by:
Greetings. I hope being a total and utter newbie will not be a problem. We use a macro-ized database for tracking and recording our concrete testing results. I say macro-ized because upon startup...
1
by: saddist | last post by:
Hello, I've been working on access 2000 for few days. I made some forms with textfields where you can type date. Those textfields had input mask set for short date 99/99/0000. Now software have...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.