473,386 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Generating Report via Select criteria

Hi everyone, very new to this whole arena and have been struggling by but am finally thinking I need a hand!

Essentially I have an Opening form, where my users click on a button to open another form to enter data to my database, which includes which shift they are on.

I have other buttons on the Opening form, which prints a report populated by a query, based on the current time it assumes the shift, so therefore it prints all the records entered by that shift.
But I would like it so when a user forgets to print at the end of a shift (likely) or I want historical records, I can enter the date and shift in a pair of combo boxes on the opening form and it would print the appropriate report, otherwise these combo boxes default to the current time and shift.

The issue I'm having is 1) we have a nightshift that straddles midnight, 10pm to 6am usually but not always on special days (another headache!), so when I query the database for records from 2nd of January for example, with my criteria for date and shift in place, It will give me from 12am to 6am on the 2nd and 10pm until midnight on the 2nd, when I really want 10pm of the 2nd onwards to 6am of the 3rd.

So I'm sure I have to write some creative SQL statement, something along the lines of "all records that ="NIGHT" and are after 12:00 of the date picked, and also all records that say ="NIGHT" before 12:00 the next day as well"

Thats it in words, but getting a syntax correct statement in SQL is driving me wild!

Anyway I do hope what I'm trying to convey is clear, i'm somewhat frazzled at the moment so if it's not please do ask for clarification.

Absolutely any help that pushes me in the right direction would be greatly appreciated.

David
Jul 26 '11 #1
2 1559
NeoPa
32,556 Expert Mod 16PB
I would suggest your solution is far simpler David. Use DateTime values instead of separate date and time ones. The shift starts at a particular time and on a particular date. #7/25/2011 22:30# is earlier than #7/26/2011 2:00# ;-)
Jul 26 '11 #2
nico5038
3,080 Expert 2GB
Hmm, looks to me you have 3 shifts and, when the shifts are fixed, I would just use a date and a shift number like:
Date: #2011-07-26#
Shift 1
In a separate table you can record the start and end time of the shift to be displayed on a form/report when needed. For the selection you can use just the date and shift number, thus no "cross midnight" problem will occur.

Idea ?

Nic;o)
Jul 26 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: elubin_nospam | last post by:
Given these two tables in DB/2: Date Activity ------------------- -------- 2005-01-02 00:00:00 1 2005-01-05 00:00:00 2 2005-01-05 00:00:01 1 2005-01-07 00:00:00 2...
3
by: jhh100 | last post by:
Hello.. I have Moderate Knowlege in Access but I'm stumped on how to figure out how to get this done.. I'll try to explain I'm trying to develop a access database that will manage engine...
3
by: billa856 | last post by:
Hi, >I have project in MS access. >In that project I am generating some reports for my company. >Now In my form I have one combobox(PalletNo_combo) >when I select an item from combobox and then...
5
by: paragpdoke | last post by:
Hello Everyone. I'm new to XSL and couldn't get something to work. Sample XML excerpt: <root> <ObjectTemplate> <NodeType1></NodeType1> <NodeType2></NodeType2> </ObjectTemplate> <Object>
1
by: lrw0831 | last post by:
I would like to create a form that allows users to select criteria to run a report. There will need to be 4 list boxes where they can select one or multiple options in each list box. The list...
5
by: emrodge | last post by:
Hi, I'm trying to design some reports which pick up action points at certain dates. Is it possible for select criteria to be based on a run time prompt - i.e. a date field being > than or = to a...
2
by: guinb | last post by:
i have a form with 2 boxes for start date and end date as well as 2 combo boxes for serial number and aircraft type. if i select a specific value for each then the rerport is generated just fine but...
4
by: anchu | last post by:
Respected sir/madam i want to generate a report and display the information in report based on specific id for example: if i enter roll no of a student in textbox so only this information should...
1
by: henricirc | last post by:
Ok so here it goes, I'm not sure if this can be done but I'm trying. I am trying to create a form "pickpatients" with a button (newsearch) and a listbox (list2) to run a query of my Visits1 table...
0
by: John Roberts | last post by:
Hi guys, My database is accessed by several users. When the user opens my report it first makes a table of temporary data from one query, then uses another query on that table to populate my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...

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.