473,387 Members | 3,781 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,387 software developers and data experts.

find shift value based on time for report

I am running a report based on a table where the time has been entered in this format HHMMSS and what I want to do is have access look at the time then instead of placing the time on the report I would like it to replace the time with a string name i.e. graveyard, day shift etc. is there a way to have it compare and then replace with the appropriate string ?
Jun 14 '07 #1
11 2521
You have to create a table with the Time String you want to display corresponding to each time of the day, and use that table in your report.
Jun 14 '07 #2
Imnew,

hmmm, you mean I have to create a table with every sec of every min of every hour and assign a shift to that second, min, hr ?

i was hoping for something like this - column in my table has 093025 and when I run my report I would like the number to be replaced with Day Shift and not the number - but i want to be able to look at the query and still see the actual number - i just want it to be replaced on the report

ie under the column heading it is "Time Created" and the column contains the numbers as above - i need to replace the number with the corresponding shift based on the number in the query

does this make sense ?
Jun 14 '07 #3
FishVal
2,653 Expert 2GB
Imnew,

hmmm, you mean I have to create a table with every sec of every min of every hour and assign a shift to that second, min, hr ?

i was hoping for something like this - column in my table has 093025 and when I run my report I would like the number to be replaced with Day Shift and not the number - but i want to be able to look at the query and still see the actual number - i just want it to be replaced on the report

ie under the column heading it is "Time Created" and the column contains the numbers as above - i need to replace the number with the corresponding shift based on the number in the query

does this make sense ?
Plz, clarify the logic used in replace.
If it can be implemented by several comparissons you may use Switch function or nested IIf function in report query or in report field.
Jun 15 '07 #4
OldBirdman
675 512MB
Why isn't this a very simple problem?

In the Properties Box, Data Tab, Record Source, use the following:
=IIf(strHHMMSS<"08","Graveyard Shift",IIf(strHHMMSS<"16","Day Shift","Swing Shift"))

Replace strHHMMSS with the correct field name. This works if the HHMMSS field is a string. If it is a Time field, replace with Hour(timeField).

Above assumes Midnight/0:00:00 to 7:59:59 as Graveyard, 8:00:00 to 15:59:59 as Day, and 16:00;00 to 23:59:59 as Swing Shift. Of course, your day shift may not be 8 to 4 and you must decide whether 8:00:00 is Graveyard or Day. Coding will be easier if shift starts on x:00:00 and ends on x:59:59.

I will be in an location without internet connection for the next week, so will not respond to questions about this response. But I just could not resist answering it.

Old Birdman
Jun 15 '07 #5
OldBirdman
675 512MB
Addendem:
The field name may have to be enclosed in square brackets [ ], therefore:
=IIf([strHHMMSS]<"08","Graveyard Shift",IIf([strHHMMSS]<"16","Day Shift","Swing Shift"))

OldBirdman
Jun 15 '07 #6
NeoPa
32,556 Expert Mod 16PB
Why isn't this a very simple problem?
The simple answer to that is that the OP didn't provide enough information.
Not everyone would feel comfortable thinking they knew which times were associated with which shifts, without that information being specified (as it should have been) in the question.
Not everyone who knows Access knows everything about everyone's question. In this case you knew enough and provided a straightforward answer.

An alternative answer (not perhaps quite as straightforward as yours, but with other benefits in some situations) would be to have a table of shifts with start and end times and a title associated. This would fit more neatly into SQL code and be easier to maintain (without touching the code). It also extends more easily if the number of shifts increases, not requiring a rewrite.

Remember, there's VERY rarely only one way to crack an egg.
Jun 17 '07 #7
OldBirdman
675 512MB
I'm sorry if I ruffled some feathers. I read this problem, and it seemed to me to be easy.

Of course, I did not address the fact that the shifts might not be the seme for each employee. A general case solution requires another table, and some code to support it.

However, as stated, the problem was to substitute a shift name for a shift time. Was I out of line to present a different solution? If someone has answered a question, should nobody suggest an alternate solution? I really do not know the ediquite here, please tell me if I am out of line here, in responding to a problem where someone has already responded.

Personally, if I present a problem to this forum, I would like as many solutions as possible. More is better. I do understand that if someone is answering, others may not, as there are too many problems for everyone to answer everything.

Bottom line is that baldrex has not responded as to whether his problem was solved or not. If not, what did all who responded miss. If his problem is solved, which solution gave him the CLUE necessary to proceed?

Old Birdman
Jun 23 '07 #8
NeoPa
32,556 Expert Mod 16PB
I would hate to think that I was discouraging you from answering questions here at all. In truth there is nothing wrong with your answer.
What I was responding to was your question (This is the bit I quoted in my reply). I was merely trying to explain to you (as you'd posed the question in the first place) why other, perhaps less simple, answers may quite validly be suggested.
If my feathers were ruffled a little, it was simply that I took the question as a criticism of other responses. I see it as my job to support all our members, particularly those who offer their time to help others.
I didn't mean to sound critical as, in truth, I wasn't sure you had meant it that way, so I answered the question as directly and straightforwardly as I could.
I would never try to criticise any member for offering a solution. Believe me there have been a few who suggested stuff that was just basically wrong. In that case I would try to explain why I thought another solution would be preferable, or explain the problem with their idea. Your answer certainly didn't fall within that category.
Jun 23 '07 #9
OldBirdman
675 512MB
OK, I cannot answer any question, as I am not one of your "Experts".

If I don't try to help other members, am I still entitled to help.

I have been slow to respond to this critizism because I did not want to over-react, but I must respond. I offered a solution to a problem AS I INTEPRETED IT. Perhaps my intepretion was incorrect, perhaps not. As we still haven't heard from "baldrex" we don't know if the real question they needed to know has been answered or not.

Have you ever heard the joke about the child who asks "Where did I come from?". After a long explanation from the mother to the asking child, the child responds "Joey is from Chicago, where am I from?". A simple question can be either simple or extremely complex. It seemed to me that the original response was too complex, and so I responded. If "baldrex" was happy with any solution, then this forum has succeeded again. If not, it failed. We don't know, unless the response with to the individual responding, and not to the general forum. It was not to me.

I really don't know how to monitor new questions, I don't know how to close a thread, and I don't know to monitor old threads submitted by me. Again, Is there a "thescripts for Dummies"? I don't find the answer promised when I first submitted that question.

OldBirdman
Jun 27 '07 #10
NeoPa
32,556 Expert Mod 16PB
My friend,
I'm not sure why you think I'm being critical.
I don't find anything to criticise. I like that you offer whatever help you can.
Jun 28 '07 #11
NeoPa
32,556 Expert Mod 16PB
I really don't know how to monitor new questions, I don't know how to close a thread, and I don't know to monitor old threads submitted by me. Again, Is there a "thescripts for Dummies"? I don't find the answer promised when I first submitted that question.

OldBirdman
There is only the FAQ, but I'm not sure that is directed at members as a User Guide.
If you have any specific "How To" questions I'll be happy to answer them for you (as, I suspect, would any of the other "staff"). Feel free to PM me if you have any questions.

-NeoPa.
Jun 28 '07 #12

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

Similar topics

2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
13
by: MLH | last post by:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If LaborCost > 0 Then Me!LaborCost.Visible = True If MatlsCost > 0 Then Me!MatlsCost.Visible = True If OtherCost > 0 Then...
24
by: shafique | last post by:
Hello, Can anybody have idea as how to find it there exist consective one's in a word/dword using bitwise operatiors in C language. Obviously this can be done by shifting and looping one by...
4
by: javatopia | last post by:
Hello, I am trying to show a Crystal Reports 10 Enterprise report in an ASP.NET page (C#). I can run the report via the admin console just fine. When I try to show the report, after setting up...
2
by: kaosyeti | last post by:
i have a report that tracks customer contacts by salespeople at a car dealership. the contacts are assigned several values, one of which is the date that they came in. the report is capeable of...
7
by: Csaba Gabor | last post by:
I'd like to detect the shift key when a button is "clicked" in Firefox/Mozilla. If the button is clicked with the mouse, no problem. However, if the onclick event is keyboard originated, then my...
3
by: Amy Smith | last post by:
Hello there, I am having a small problem which been challenging me for few days and need help or advice. I am trying to calculate the day-shift for employees based on the time they started and...
1
by: LiveTecs | last post by:
http://www.livetecs.com TimeLive Web Collaboration Suite is an integrated suite that allows you to manage project life cycle including tasks, issues, bugs, timesheet, expense, attendance. ...
5
by: accesstruggle | last post by:
Hello, I am having trouble with my database in Access. The problem lies in my report. I have created a report based off a query. The query contains all values that I'll need for my report- some will...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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.