473,659 Members | 3,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11330
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*********@hot mail.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*********@ho tmail.com> wrote in message
news:a0******** *************** ***@posting.goo gle.com...
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
7824
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 the issue. I hope I've included all relevant information. On a form, I have a DateTimePicker with the following
1
4841
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 before Windows 2000 Service Pack 4 and has remained through to Windows XP. I am looking for a solution that doesn't involve rewriting our application (much) and that allows all our users to keep using Hebrew Regional Settings. To summarize our...
1
2998
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 check for a complete years. And a complete year is from day 1 until the proceeding day the following year. A couple of examples:
3
11578
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 overlap existing records from the same table. I had this all working some time ago, but recently when I have gone back to do more testing, part of these validations no longer work. While there have been changes to the code in the meantime, I cannot...
12
29445
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 follows: function doDateCheckNow(source, args) { var oDate = document.getElementById(source.controltovalidate); // dd/mm/yyyy
5
3161
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 tables in it. One of my forms has two TEXT BOX controls formated as Short Date. The form is binded to a linked table. The linked tables has about 7 records and one of the control is binded to a table field. These two controls displays the date...
1
1912
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, TransactionCourses.CourseDate FROM TransactionCourses WHERE (((TransactionCourses.CourseID)=1103) AND ((TransactionCourses.CourseDate)=#3/8/2000#)) ORDER BY TransactionCourses.MbrID, TransactionCourses.CourseDate; ---------------
5
1798
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 there appears to be a start page with 8 or so buttons that run different functions and take you to different "rooms" within the database. All these "macros" work fine except for one that prints a list of test specimens that need to be tested on a given...
1
2813
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 changed and some computers have access 2000 and some have access 2003, where date format is 0000/00/00. Is there some way for input mask to change depending on access version? I know the date format will convert from 2000 to 2003 (I don't know if it'd...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.