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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help with Function: Between Time



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 03:07 PM posted to microsoft.public.access.gettingstarted
Bre-x
external usenet poster
 
Posts: 103
Default Help with Function: Between Time

Hi,

Why this function is not working?

If a time follows between 12AM and 3PM it should show Day shift, anything
else Night Shift

If Time #12:01:00 AM# #3:00:00 PM# Then
MsgBox "DAY SHIFT"
Else
MsgBox "NIGTH SHIFT"
End If


  #2  
Old May 27th, 2010, 03:53 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default Help with Function: Between Time

If Time #12:01:00 AM# AND Time #3:00:00 PM# Then
MsgBox "DAY SHIFT"
Else
MsgBox "NIGTH SHIFT"
End If

Note that you need to repeat the entire comparison.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Bre-x wrote:
Hi,

Why this function is not working?

If a time follows between 12AM and 3PM it should show Day shift, anything
else Night Shift

If Time #12:01:00 AM# #3:00:00 PM# Then
MsgBox "DAY SHIFT"
Else
MsgBox "NIGTH SHIFT"
End If


  #3  
Old May 27th, 2010, 03:58 PM posted to microsoft.public.access.gettingstarted
Steve[_77_]
external usenet poster
 
Posts: 1,017
Default Help with Function: Between Time

Several things .......
1. Time is an Access function and returns the current system time.
2. If Time is a field, you need to change the name to something else.
3. If Time #12:01:00 AM# #3:00:00 PM# Then should be:
If Time #12:01:00 AM# And Time #3:00:00 PM# Then
4. "NIGTH SHIFT" is mispelled. Should be "Night Shift"

Steve




"Bre-x" wrote in message
...
Hi,

Why this function is not working?

If a time follows between 12AM and 3PM it should show Day shift, anything
else Night Shift

If Time #12:01:00 AM# #3:00:00 PM# Then
MsgBox "DAY SHIFT"
Else
MsgBox "NIGTH SHIFT"
End If




  #4  
Old May 27th, 2010, 04:03 PM posted to microsoft.public.access.gettingstarted
Bre-x
external usenet poster
 
Posts: 103
Default Help with Function: Between Time

Thank you both!!!

Bre-x


"Bre-x" wrote in message
...
Hi,

Why this function is not working?

If a time follows between 12AM and 3PM it should show Day shift, anything
else Night Shift

If Time #12:01:00 AM# #3:00:00 PM# Then
MsgBox "DAY SHIFT"
Else
MsgBox "NIGTH SHIFT"
End If




 




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 01:16 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.