473,771 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query by 24 hour Shift

Access 2003

I need to create a query to view data by 3 - 24 hour shifts. Ex: There
are 3 shifts, each shift is 24 hours starting at 0700 through 0700.
Each shift is designated as A, B, or C. 01/01/2006 is an "A" shift.

The data does have a date field that contains both date and time.

Could anyone point me in the right direction to get started?

Any and All help truly appreciated!
Dale

Mar 2 '06 #1
2 2943
mt****@yadtel.n et wrote:
Access 2003

I need to create a query to view data by 3 - 24 hour shifts. Ex: There
are 3 shifts, each shift is 24 hours starting at 0700 through 0700.
Each shift is designated as A, B, or C. 01/01/2006 is an "A" shift.

The data does have a date field that contains both date and time.

Could anyone point me in the right direction to get started?

Any and All help truly appreciated!
Dale

Just some random thoughts.

One thing to remember while designing queries is that if you stuff a
field with a Now() value (date and time), it is not the same as a Date()
stuff (date and time of 00:00:00). Let's say you want to check for
something between March 1 and March 2. Using dates only, you can query
on that. If you use time, you need to specify times also. For example,
if you asked to get something between March 1 and March 2, it would only
retrieve those records between March 1 at 00:00:00 and March 2 at
00:00:00.

You might want to add an extra field, called DateOfShift. Sure, you can
calc out the date from your date/time field, but someone may start their
second shift after midnight and could be excluded. So stuff DateOfShift
with the date (no time). Less calcs later on. Thus you could query from
records with a start date of March 2 and then by shift category, and
then start date/time.
Mar 2 '06 #2
I was faced to the same issue. I added another field for the date of start
of the shift which is populated by a function (that could be simplified
again)
Public Function DateStartShUpd( sh As String, DateStart As Date) As Date

On Error GoTo err_DateStartSh Upd

Dim ShEnd As Date, DayNo As Integer, d0 As Date, HrBegin As Date, UpdStatus
As Integer, UpdStatusInfo As String

DayNo = WeekDay(DateSta rt)

Select Case WeekDay(DateSta rt)
Case 1
HrBegin = Nz(DLookup("sSu ndayBegin", "tblShift", "ShiftNo='" & sh &
"'"), "")
Case 2
HrBegin = Nz(DLookup("sMo ndayBegin", "tblShift", "ShiftNo='" & sh &
"'"), "")
Case 3
HrBegin = Nz(DLookup("sTu esdayBegin", "tblShift", "ShiftNo='" & sh &
"'"), "")
Case 4
HrBegin = Nz(DLookup("sWe dnesdayBegin", "tblShift", "ShiftNo='" & sh &
"'"), "")
Case 5
HrBegin = Nz(DLookup("sTh ursdayBegin", "tblShift", "ShiftNo='" & sh &
"'"), "")
Case 6
HrBegin = Nz(DLookup("sFr idayBegin", "tblShift", "ShiftNo='" & sh &
"'"), "")
Case 7
HrBegin = Nz(DLookup("sSa turdayBegin", "tblShift", "ShiftNo='" & sh &
"'"), "")

End Select

d0 = Format(DateStar t, "yyyy-mm-dd")

If Format(HrBegin, "hh:nn") <= Format(DateStar t, "hh:nn") Then
DateStartShUpd = d0
Else
DateStartShUpd = DateAdd("d", -1, d0)
End If
exit_DateStartS hUpd:

Exit Function

err_DateStartSh Upd:
If Err.Number = 94 Then
MsgBox Err.Number & " " & Err.Description
'MsgBox "Work shift starting hour or duration invalid."
Resume Next
'Exit Function
End If

End Function

<mt****@yadtel. net> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
Access 2003

I need to create a query to view data by 3 - 24 hour shifts. Ex: There
are 3 shifts, each shift is 24 hours starting at 0700 through 0700.
Each shift is designated as A, B, or C. 01/01/2006 is an "A" shift.

The data does have a date field that contains both date and time.

Could anyone point me in the right direction to get started?

Any and All help truly appreciated!
Dale

Mar 3 '06 #3

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

Similar topics

5
1702
by: angelasg | last post by:
I am working with employee schedules. Each schedule is comprised of segments (shift, lunch, break, training, etc.) that have rankings. Each record has the employee id, the date the shift starts, the start and end time of each segment, the duration,the segment type and its rank. The start and end times of the schedules can overlap, but the segment that has the higher rank takes precedence. As a simple example, an employee working 8a-5p...
3
1548
by: Mark Reed | last post by:
Hi all, I have a query at the moment which shows what people have been doing on a certain department throughout an entire shift. It shows the start (Min) time and end (Max) time and then shows total time doing the job. I have now been asked if I can get it to show what they have been doing hour by hour. so the format would need to be something along the lines of : Date Start End Forname Surname Login Ctns Diff
1
455
by: Michelle | last post by:
Hi all I am having problems creating an update query. I have 2 tables, tblPublishRoster and tblCCAgents_Changed_Shifts. I want to select all records from tblCCAgents_ChangedShifts where RosterDate falls within a given date range, AgentID = 0 and FullName Is Null.
5
6591
by: Brooks Clayton | last post by:
I have an A97 db on Win2k machine. I have a make table query to update a small db wich we then FTP to our website for customer order status. What is the best way to automate the query to run once per hour? (I made a macro to run the query, but it seems that Windows Scheduler will only run once per day.) It would be really neat if I could have Access97 actually FTP the new db every hour. Thanks,
2
3842
by: Keith C. Perry | last post by:
Ok, I've tried a number of things here and I know I'm missing something but at this point my head is spinning (i.e. lack of sleep, too much coffee, etc...) My environment is PG 7.4.3 on Linux with 512Mb of ram and swap. This was just upgraded from 7.4 (just to make sure I'm current). Some of my settings in postgresql are giving fatal errors but I don't think my issue is related to my query problems. I also have a laptop running with...
3
2822
by: hharriel | last post by:
Hi All, I have created an update query related to high school course information (name of course; credit hour; course description, etc.) I am updating a master course information table. I am updating two fields in the master table; course name and credit hour. When I run a test, the course name updates fine. However, I have three different values that can be in the credit hour files: .05, 1, and 2 (also there are some records that don't...
2
1741
by: Trees | last post by:
I have a query I am trying to create based on another query (inventory) and a table. The inventory query shows the date, shift, Die set and the # of shifts remaining for each die set in inventory. The table has a corresponding date and shift field as well as two more fields that tell me what die set was left in the line at the end of the previous shift and what die set is staged to go in next (again left from the previous shift). ...
0
1643
by: Massimiliano Campagnoli | last post by:
Good morning, I have a table like (Date, Hour, Value) where Date can be any date, Hour is always between 6 (6am) to 22 (10pm) and Value is an integer. E.G. Date Hour Value 23/2/2002 6 2 23/2/2002 7 3
5
17672
by: hassanhundal007 | last post by:
In my table the field of DateTime name is TIN. In this field DATE and TIME are shown for date I pass this query: SELECT DAY(TIN) FROM SHIFT WHERE SHID = 1 Then the result is "10". So the same I want to get Hour fromt his field I pass this query: SELECT HOUR(TIN) FROM SHIFT WHERE SHID = 1 But it gives this error:
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10102
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.