473,583 Members | 4,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Date as Parameter - Between 4/1 and 4/18 doesn't inlclude 4/18records

Hi -
I have had this problem MANY times and I just don't think I have the
best solution.

I am running a parameter query to retrieve records where work was
completed between 2 dates. The "completed date" field contains both
date and time (e.g., 11/4/07 15:44:00) and does need the time for the
data to be properly recorded.

That said, is it possible to format the parameter "Between [Enter
start date] and [Enter end date]" to enable the user to enter just the
dates when prompted rather than the date and time to retrieve all
records betwen the dates?

Currently, to retrieve records completed between 4/1/08 and 4/18/08 by
entering dates only, the user must enter 4/19/08 to retrieve a record
that was completed some time during 4/18/08.

I tried adding a field to the query:
JustDate: DateValue([CallDateAndTime]) with
Between [Start date] and [End Date]

and tried
Between DateValue([Start date] and Datevalue([End Date])

Got errors - couldn't run code - too complex...

I can do it if I say between [End date] +1, but there MUST be a
"proper" way!

Thanks
sara
Jun 27 '08 #1
5 2504
Hi Sara,

Instead of using Between try this:

Dim RS As DAO.RecordSet
Set RS = CurrentDB.OpenR ecordset("Selec t * From ... Where Date1 >= #" &
txtStartDate & "# And Date2 <= #" & txtEndDate & "#")

And then retrieve whatever data you need from the recordset object

Or if you are using a parameter Query try this:

In the StartDate field enter this:
>=Forms!yourFor m!txtStartDate

in the EndDate field enter this:

<=Forms!yourFor m!txtEndDate

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #2

"sara" <sa*******@yaho o.comwrote in message
news:63******** *************** ***********@u69 g2000hse.google groups.com...
Hi -
I have had this problem MANY times and I just don't think I have the
best solution.

I am running a parameter query to retrieve records where work was
completed between 2 dates. The "completed date" field contains both
date and time (e.g., 11/4/07 15:44:00) and does need the time for the
data to be properly recorded.

That said, is it possible to format the parameter "Between [Enter
start date] and [Enter end date]" to enable the user to enter just the
dates when prompted rather than the date and time to retrieve all
records betwen the dates?

Currently, to retrieve records completed between 4/1/08 and 4/18/08 by
entering dates only, the user must enter 4/19/08 to retrieve a record
that was completed some time during 4/18/08.

I tried adding a field to the query:
JustDate: DateValue([CallDateAndTime]) with
Between [Start date] and [End Date]

and tried
Between DateValue([Start date] and Datevalue([End Date])

Got errors - couldn't run code - too complex...

I can do it if I say between [End date] +1, but there MUST be a
"proper" way!

Thanks
sara
Add 1 day to the entered end date. Date fields with time included are
greater than dates without time.

Between [Start Date] And DateAdd("d",1,[End Date])
Jun 27 '08 #3
On Thu, 17 Apr 2008 12:59:31 -0700 (PDT), sara <sa*******@yaho o.comwrote:
>Hi -
I have had this problem MANY times and I just don't think I have the
best solution.

I am running a parameter query to retrieve records where work was
completed between 2 dates. The "completed date" field contains both
date and time (e.g., 11/4/07 15:44:00) and does need the time for the
data to be properly recorded.

That said, is it possible to format the parameter "Between [Enter
start date] and [Enter end date]" to enable the user to enter just the
dates when prompted rather than the date and time to retrieve all
records betwen the dates?

Currently, to retrieve records completed between 4/1/08 and 4/18/08 by
entering dates only, the user must enter 4/19/08 to retrieve a record
that was completed some time during 4/18/08.

I tried adding a field to the query:
JustDate: DateValue([CallDateAndTime]) with
Between [Start date] and [End Date]

and tried
Between DateValue([Start date] and Datevalue([End Date])

Got errors - couldn't run code - too complex...

I can do it if I say between [End date] +1, but there MUST be a
"proper" way!

Thanks
sara
What does "between" mean in Access? The help file is not very helpful.
However, reading between the lines suggests that between means "greater than or
equal to " and "less than" (>= and <). That means that in Access, 'between'
means including first value but not including last value.

From a dictionary: "Thus in the sentence The bomb landed between the houses,
the houses are seen as points that define the boundaries of the area of impact
(so that we presume that none of the individual houses was hit)." To me this
is and <.
Jun 27 '08 #4
On Apr 17, 4:11*pm, Rich P <rpng...@aol.co mwrote:
Hi Sara,

Instead of using Between try this:

Dim RS As DAO.RecordSet
Set RS = CurrentDB.OpenR ecordset("Selec t * From ... Where Date1 >= #" &
txtStartDate & "# And Date2 <= #" & txtEndDate & "#")

And then retrieve whatever data you need from the recordset object

Or if you are using a parameter Query try this:

In the StartDate field enter this:
=Forms!yourForm !txtStartDate

in the EndDate field enter this:

<=Forms!yourFor m!txtEndDate

Rich

*** Sent via Developersdexht tp://www.developersd ex.com***
Thanks very much. I was thinking that it could be done without the >=
or whatever, but I understand it can't. I'm all set.
Jun 27 '08 #5
On Apr 17, 4:28*pm, "paii, Ron" <n...@no.comwro te:
"sara" <saraqp...@yaho o.comwrote in message

news:63******** *************** ***********@u69 g2000hse.google groups.com...


Hi -
I have had this problem MANY times and I just don't think I have the
best solution.
I am running a parameter query to retrieve records where work was
completed between 2 dates. The "completed date" field contains both
date and time (e.g., 11/4/07 15:44:00) and does need the time for the
data to be properly recorded.
That said, is it possible to format the parameter "Between [Enter
start date] and [Enter end date]" to enable the user to enter just the
dates when prompted rather than the date and time to retrieve all
records betwen the dates?
Currently, to retrieve records completed between 4/1/08 and 4/18/08 by
entering dates only, the user must enter 4/19/08 to retrieve a record
that was completed some time during 4/18/08.
I tried adding a field to the query:
JustDate: *DateValue([CallDateAndTime]) with
Between [Start date] and [End Date]
and tried
Between DateValue([Start date] and Datevalue([End Date])
Got errors - couldn't run code - too complex...
I can do it if I say between [End date] +1, but there MUST be a
"proper" way!
Thanks
sara

Add 1 day to *the entered end date. Date fields with time included are
greater than dates without time.

Between [Start Date] And DateAdd("d",1,[End Date])- Hide quoted text -

- Show quoted text -

Thanks very much. I was thinking that it could be done without the >=
or whatever, but I understand (now) it can't. I'm all set.
Jun 27 '08 #6

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

Similar topics

15
42993
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to mediate between webapps and arbitrary database backends using JDBC. I am very unwilling indeed to write special-case code for particular databases. Our...
10
2966
by: Kenneth | last post by:
I have a Query that consist of a lot of different sales data, and one of the colums are different date. The date goes from 1jan2003 til 31jan2003. in this Query I only want the salesdata for 1jan2003. How do I remove the dates , 2jan2003 til 31jan2003 without removing them from the table, from the Query? (Because I want to use the data for...
4
4476
by: Tony | last post by:
Hey guys, I use Google Groups quite a bit as it is an enormous wealth of information, and now I need some help. I have created a query using parameters to capture a range of date, the date is also formatted. test: Format(,"mm/dd/yy") Between And
2
3836
by: Sara | last post by:
I have followed instructions on the http://allenbrowne.com/tips.html for limiting a report to a date range. At the bottom there is a note that says You will end up using this form for all sorts of reports. You may add an option group or list box that selects which report you want printed, and a check box that determines whether the report...
8
3251
by: JIM.H. | last post by:
Hello, I am calling a stored procedure to update my table. If one of the date on the screen left empty, I need to send date as null. Since MyDate=”” gives error in asp.net, how should I do this? Thanks, Jim.
10
6860
by: John Austin | last post by:
I am migrating my first vb6 app to vb.net 2003. In the vb6 app a number of subs had optional date parameters: Sub Fred ( ... ,optional FromDate as Date = 0...) I need something like zero in there to see if the parameter has been used or not. In vb.net the imported code fails with: Value of type 'Integer' cannot be converted to 'Date'
20
35452
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the project the date format in vb.code ( not in Windows) and how can I find out which date format the PC Windows is using. Thanks for any response
2
4586
by: Billy | last post by:
This string is supposed to provide all records from an MDB database that match the courier and date specified in the query. I Response.Write the query and I get a date as 1/27/2007. The date format style is exactly the field specification as I see in the MDB Date field in the Courier table. The data for this query exists - both the courier...
2
2052
by: anwest75 | last post by:
Hi, I'm not a newb to Access but have recently migrated to 2007 and suddenly my method doesn't seem to work. I'm generating a service award report where I need to show only those employees hitting a milestone during a certain period of time. I've had Access calculate the appropriate milestone date, and now I want to pull only those records where...
0
7825
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...
0
8179
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. ...
0
8323
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...
0
8191
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5700
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...
0
5372
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...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2331
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
1
1431
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.