Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Build expression to display work shift on which record was created

Status
Not open for further replies.

jkupov

Technical User
Joined
Apr 28, 2004
Messages
101
Location
US
I'm trying to figure out how to create an expression which will simply display "Day Shift" or "Swing Shift" based on a field which displays a time stamp when an employee enters a record into the database.

I'm using Access 2007 to connect to an Oracle DB over an ODBC connection.

I know the solution is probably simple, but I haven't been able to convince the boss to send me to an access class to learn this stuff so i'm still flying by trial and error.

The field which displays the timestamp is displayed like mm/dd/yyyy hh:mm:ss.

The expression that I've been trying to build should just take all the records between 6AM and 3PM and display "Day Shift" and then those from 3pm to 11pm and display "Night Shift".

Any ideas? Thanks.

Joseph Kupovlevski
 
Do you mean something like:

[tt]SELECT IIf(Format([timestamp],"hh") Between 6 And 15,"Day Shift","Night Shift") AS Shift
FROM SomeTable[/tt]
 
Have a look at the IIf and TimeValue functions.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top