

Access query structure not working
#1
Posted 22 February 2011 - 06:26 PM

Register to Remove
#2
Posted 24 February 2011 - 09:16 PM
Its not likely you'll have any items at that exact time.
So, when performing the query you can't just look for fields that contain an exact date without specifying a time. To work around this you need to search for a range of times on certain dates. i.e. From midnight to 11:59:59PM on the same day in order to find all records on that date.
In the query designer you can change the criteria from something like this: =[Date]
to: Between [Date] And [Date] & " 23:59:59"
This prompts the user to enter a date, and then searches for records between a certain time range on that date by appending the time on to the second value. The first value already has a default time of midnight so we don't actually have to append 00:00:00 to that one.
If you are looking for a date range you can use: Between [StartDate] and [EndDate] & " 23:59:59"
Edited by appleoddity, 24 February 2011 - 09:17 PM.
The help you have been given is free. If you have been happy with our help please consider donating to support this forum.
If you would like to say thanks for the help I have given you please View My Profile and Leave a Comment.
Your encouragement is welcome.
#3
Posted 25 February 2011 - 09:00 AM
#4
Posted 25 February 2011 - 09:39 AM
The help you have been given is free. If you have been happy with our help please consider donating to support this forum.
If you would like to say thanks for the help I have given you please View My Profile and Leave a Comment.
Your encouragement is welcome.
#5
Posted 28 February 2011 - 07:09 PM

Thanks anyway!
Sierra
#6
Posted 28 February 2011 - 08:17 PM

I spent a half hour researching your problem, and literally implementing local solutions until I was sure of the results.
I then came back here and posted exactly why you have the problem you have, how to resolve it, and gave you literal examples of exactly what to do.\
In the query designer you can change the criteria from something like this: =[Date]
to: Between [Date] And [Date] & " 23:59:59"
The help you have been given is free. If you have been happy with our help please consider donating to support this forum.
If you would like to say thanks for the help I have given you please View My Profile and Leave a Comment.
Your encouragement is welcome.
#7
Posted 04 March 2011 - 03:10 AM
Not sure if the syntax works with access but you can do something like this in SQL Server:
WHERE CONVERT(VARCHAR(10), DATETIMEFIELD, 101) BETWEEN '03/01/2011' AND '03/01/2011'
No need for the timestamp here. Just change the DATETIMEFIELD, '03/01/2011', '03/01/2011' to your specification.
Proud graduate of WTT Classroom
The help we provide here is free, however, if you wish to donate, you can do so here: http://www.whatthetech.com/donate/
ASAP and UNITE member
________________________________________________
!
#8
Posted 04 March 2011 - 09:57 AM
#9
Posted 04 March 2011 - 07:56 PM
Edited by appleoddity, 04 March 2011 - 07:57 PM.
The help you have been given is free. If you have been happy with our help please consider donating to support this forum.
If you would like to say thanks for the help I have given you please View My Profile and Leave a Comment.
Your encouragement is welcome.
#10
Posted 05 March 2011 - 01:59 AM
What I meant by not needing the timestamp there is that it does not need to be added in the query or front end as you call it as it will pull all the necessary data pertaining to your query, including the timestamp part of your datetime field.I do need the time stamp, unfortunately. Don't need it on the front end, but the end date needs either "11:59 PM" or 23:59:59 to pull the data.
The use of BETWEEN keyword there is to extract the data from a specified date to the end date. If you only want to draw out the transaction for a single day then there is no need to use BETWEEN. You can do it like so:
WHERE CONVERT(VARCHAR(10), DATETIMEFIELD, 101) = 'mm/dd/yyyy'
That will extract the data for a single day. As I've said earlier there is no need to add the time stamp there as the query will only concentrate on the date specified, no matter what the time is as it will show the transactions made, including the timestamp part, in that particular date. Try it.
Proud graduate of WTT Classroom
The help we provide here is free, however, if you wish to donate, you can do so here: http://www.whatthetech.com/donate/
ASAP and UNITE member
________________________________________________
!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users