A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date and Time Problems



 
 
Thread Tools Display Modes
  #1  
Old June 24th, 2008, 11:06 AM posted to microsoft.public.access.queries
Jurrasicway
external usenet poster
 
Posts: 11
Default Date and Time Problems

Can anyone please help with the following:

I have a database of transations that are time stamped. The time stamp is as
follows:

24/05/2008 23:22:47

What do I need to put into my querey box to pick up transactons between two
times on every day. If it was just the time or the date it would be easy.
However I need all days to be measured and only transactions between two
times to be shown
EG
All transactions between 23:00 and 01:00 (Between 23:00 and 01:00)
Thanks

  #2  
Old June 24th, 2008, 11:46 AM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Date and Time Problems

So you have these in a Date/Time field named (say) TranslateDateTime?

In query design view, enter this expression into the Field row:
TheTime: IIf([TranslateDateTime] Is Null, Null,
TimeValue([TranslateDateTime]))

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jurrasicway" wrote in message
...
Can anyone please help with the following:

I have a database of transations that are time stamped. The time stamp is
as
follows:

24/05/2008 23:22:47

What do I need to put into my querey box to pick up transactons between
two
times on every day. If it was just the time or the date it would be easy.
However I need all days to be measured and only transactions between two
times to be shown
EG
All transactions between 23:00 and 01:00 (Between 23:00 and 01:00)
Thanks


  #3  
Old June 24th, 2008, 12:29 PM posted to microsoft.public.access.queries
Jurrasicway
external usenet poster
 
Posts: 11
Default Date and Time Problems

Hi Allen,

When I entered
TheTime: IIf([TransactionDate] Is Null,Null,TimeValue([TransactionDate]))
I got an invalid operator error
I then entered
IIf([TransactionDate] Is Null,Null,TimeValue([TransactionDate]))
but no records were shown. I take it that TheTime will prompt an entry box
for me to input the time that I need transactions for?

"Allen Browne" wrote:

So you have these in a Date/Time field named (say) TranslateDateTime?

In query design view, enter this expression into the Field row:
TheTime: IIf([TranslateDateTime] Is Null, Null,
TimeValue([TranslateDateTime]))

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jurrasicway" wrote in message
...
Can anyone please help with the following:

I have a database of transations that are time stamped. The time stamp is
as
follows:

24/05/2008 23:22:47

What do I need to put into my querey box to pick up transactons between
two
times on every day. If it was just the time or the date it would be easy.
However I need all days to be measured and only transactions between two
times to be shown
EG
All transactions between 23:00 and 01:00 (Between 23:00 and 01:00)
Thanks



  #4  
Old June 24th, 2008, 12:53 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Date and Time Problems

Where TimeValue(TransactionTime) = #23:00:00#
Or TimeValue(TransactionTime) = #01:00:00#

If your time period did not overlap days then
WHERE TimeValue(TransactionTime) Between #13:00:00# And #14:30:00#

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County

Jurrasicway wrote:
Can anyone please help with the following:

I have a database of transations that are time stamped. The time stamp is as
follows:

24/05/2008 23:22:47

What do I need to put into my querey box to pick up transactons between two
times on every day. If it was just the time or the date it would be easy.
However I need all days to be measured and only transactions between two
times to be shown
EG
All transactions between 23:00 and 01:00 (Between 23:00 and 01:00)
Thanks

  #5  
Old June 24th, 2008, 01:27 PM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Date and Time Problems

TheTime was just an alias for the field. If you don't do this, Access
provides Expr1 (which is fine, but not meaningful.)

Try just this in the Field row:
TimeValue([TransactionDate])
with this in the Criteria row:
Is Not Null

The reason for the criteria is that TimeValue() errors on Null. Once you
have that working, you can expand it.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jurrasicway" wrote in message
...
Hi Allen,

When I entered
TheTime: IIf([TransactionDate] Is Null,Null,TimeValue([TransactionDate]))
I got an invalid operator error
I then entered
IIf([TransactionDate] Is Null,Null,TimeValue([TransactionDate]))
but no records were shown. I take it that TheTime will prompt an entry box
for me to input the time that I need transactions for?

"Allen Browne" wrote:

So you have these in a Date/Time field named (say) TranslateDateTime?

In query design view, enter this expression into the Field row:
TheTime: IIf([TranslateDateTime] Is Null, Null,
TimeValue([TranslateDateTime]))

"Jurrasicway" wrote in message
...
Can anyone please help with the following:

I have a database of transations that are time stamped. The time stamp
is
as
follows:

24/05/2008 23:22:47

What do I need to put into my querey box to pick up transactons between
two
times on every day. If it was just the time or the date it would be
easy.
However I need all days to be measured and only transactions between
two
times to be shown
EG
All transactions between 23:00 and 01:00 (Between 23:00 and 01:00)


  #6  
Old June 24th, 2008, 03:17 PM posted to microsoft.public.access.queries
Jurrasicway
external usenet poster
 
Posts: 11
Default Date and Time Problems

John, Thanks for this
I got it by doing the following

Field TransationDate
Criteria TimeValue([TransactionDate])=#23:00:00#
Or TimeValue([TransactionDate])=#01:00:00#

Many Many thanks

"John Spencer" wrote:

Where TimeValue(TransactionTime) = #23:00:00#
Or TimeValue(TransactionTime) = #01:00:00#

If your time period did not overlap days then
WHERE TimeValue(TransactionTime) Between #13:00:00# And #14:30:00#

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County

Jurrasicway wrote:
Can anyone please help with the following:

I have a database of transations that are time stamped. The time stamp is as
follows:

24/05/2008 23:22:47

What do I need to put into my querey box to pick up transactons between two
times on every day. If it was just the time or the date it would be easy.
However I need all days to be measured and only transactions between two
times to be shown
EG
All transactions between 23:00 and 01:00 (Between 23:00 and 01:00)
Thanks


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.