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!

Query for all variations of 3 data types

Status
Not open for further replies.

skcrival

Technical User
Joined
Nov 5, 2008
Messages
11
Location
US
Info below shows which benefits an employee receives based on their status (full-time/part-time) and yearly hours worked.

Benefits EE Status Hrs/Year
100% Full-Time Regular 2080
80% Part-Time Regular 1664-2028
70% Part-Time Regular 1248-1820
NONE Part-Time Regular <1248

The table I'm querying against contains all 3 of these fields/columns for each employee. How do I specify criteria that would return 1 column matches, columns 2 and 3 don't match AND records where column 2 matches but columns 1 and 3 don't and so forth?

Anotherwards capture all variations that don't match exactly across (e.g. 100%; Full-Time Reg; 2080), where any one of the three fields are incorrect.

 

I don't think you'll be able to easily query using the Hrs/Year field you currently have. Consider changing it to reflect just the MAXIMUM value. Then your queries can look for:
1. Status = Full-Time
2. Status = Part-Time and Hrs/Year < ####

For the part-time employees, use a case (or if) statement, something like:
Code:
SELECT Case Hrs/Year
    Case < 1248:
        Benefits = 0
    Case < 1821:
        Benefits = 70
    Case < 2029:
        Benefits = 80
    Case Else:
        Benefits = ??
End Select


Randy
 

I'm not familiar with Case Statements.
How would I go about setting this up in the query design view of Access (2002)?

 

Something like....
Code:
iif([Hrs/Yr] < 1248, 0, iif([Hrs/Yr] < 1821, 70, iif([Hrs/Yr] < 2029, 80, ??)))

Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top