473,383 Members | 1,815 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,383 software developers and data experts.

Date/Calendar query

Si
Hi all,

I have an events database (Access) that contains 2 fields, StartDate and
EndDate. The fields are set as Date/Time long date. The server is UK
date format (dd/mm/yyyy)

I have a small calendar that changes the day of the month to a link if
an event exists for that day.

I start off on day 1 of the month and use a loop through the month until
the last day. Each run through the month queries the DB to see if an
events exists with this sql:

sql="SELECT ListingsID FROM tblEventsListings WHERE StartDate <= #" &
DispDate & "# AND EndDate >= #" & DispDate & "#;"

The DispDate is generated as part of the loop and is producing the date
correctly.

My problem is that if an event has the same start/finish day (single day
event) then it gets missed. Also, an event that runs over a couple of
months seems to randomly be displayed. eg, the calendar will show an
event exists for 4 days, then 5 days of no event then events exist for
the rest of the month. (The whole month should reflect an event on every
day.)

Sorry if this is a bit long winded! I'm stumped! Is there a better way
to do this loop?

Simon
Aug 25 '05 #1
2 1725
Si wrote on 25 aug 2005 in microsoft.public.inetserver.asp.general:
I have an events database (Access) that contains 2 fields, StartDate and
EndDate. The fields are set as Date/Time long date. The server is UK
date format (dd/mm/yyyy)

I have a small calendar that changes the day of the month to a link if
an event exists for that day.

I start off on day 1 of the month and use a loop through the month until
the last day. Each run through the month queries the DB to see if an
events exists with this sql:

sql="SELECT ListingsID FROM tblEventsListings WHERE StartDate <= #" &
DispDate & "# AND EndDate >= #" & DispDate & "#;"

The DispDate is generated as part of the loop and is producing the date
correctly.

My problem is that if an event has the same start/finish day (single day
event) then it gets missed. Also, an event that runs over a couple of
months seems to randomly be displayed. eg, the calendar will show an
event exists for 4 days, then 5 days of no event then events exist for
the rest of the month. (The whole month should reflect an event on every
day.)

Sorry if this is a bit long winded! I'm stumped! Is there a better way
to do this loop?


Date values include the time of day,
so 2005/08/25 13:00 <= 2005/08/25 gives false,
while 2005/08/25 13:00 >= 2005/08/25 gives true.
Does this solve your problem?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Aug 25 '05 #2
Si wrote:
Hi all,

I have an events database (Access) that contains 2 fields, StartDate
and EndDate. The fields are set as Date/Time long date. The server is
UK date format (dd/mm/yyyy)
Not relevant. Access, along with most other database products, does not
store date/times with any format. Jet (Access) stores dates as Double
numbers, with the whole number portion representing the number of days from
the seed date (I forget what seed date Jet uses - you can find out by
running this query: Select CDate(0) ), and the decimal portion representing
the time of day (.5 = noon). It is the client application that retrieves the
dates from Jet that applies the formatting (and yes, Access itself is a
client application using the Jet database as its backend).

I have a small calendar that changes the day of the month to a link if
an event exists for that day.

I start off on day 1 of the month and use a loop through the month
until the last day. Each run through the month queries the DB to see
if an events exists with this sql:

sql="SELECT ListingsID FROM tblEventsListings WHERE StartDate <= #" &
DispDate & "# AND EndDate >= #" & DispDate & "#;"

http://www.aspfaq.com/show.asp?id=2040

Bob barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Aug 25 '05 #3

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

Similar topics

2
by: cg_news | last post by:
In short, what I am trying to do is, based on a date, calculate the week of year (as described in ISO 8601), then calculate the first and last date in this week period and return them in the format...
3
by: Scott Morford | last post by:
I am developing a weed management database for the preserve I work on. One of the queries I'm working on will allow the user to run a query and see which weed patches have NOT been treated in the...
8
by: John Wildes | last post by:
Hello all I'm going to try and be brief with my question, please tell me if I have the wrong group. We are querying transaction data from a DB3 database application. The dates are stored as...
7
by: 4004 | last post by:
Where am I going wrong? I have a form which has a record for each date on which I teach. It has a subform which shows the classes that I teach that day. So I want to be able to click on a...
1
by: balleyman47 | last post by:
getting the following error when executing an insert statement: java.lang.IllegalArgumentException: Date/Time must be JDBC format running on UDB 8.2 fix pack 10 using IBM type IV driver. Query...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
2
by: Gooseman | last post by:
Hi, I have a query which works for one day: SELECT SOME_COL AS something, SOME_COL2 AS something2 FROM myTable WHERE DATE = '2007-05-11' AND SOME_STAT 1 Returns something something 2
1
osward
by: osward | last post by:
Hi everyone, Background 1. I have a table that consits 400+ rows of data and is growing by day. The table already has paging links at the bottom but I restricted to display rows of data only >=...
10
by: sweatha | last post by:
Hi Can anybody help me how to block all dates in calendar control till the current date.
19
by: phill86 | last post by:
Hi I am re-posting this thread because it has become very confusing and I have got some way to solving the problem so it is a slightly different question from the initial thread. here is the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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...

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.