View Single Post
  #5  
Old June 3rd, 2010, 07:09 PM posted to microsoft.public.access.queries
Keith
external usenet poster
 
Posts: 531
Default querying unrelated tables

Thanks Jeff.

I understand your logic, however, in your "HolidayName: IIF(PunchDate =
HolidayDate, [HolidayName], "")" statement, PunchDate will never equal
HolidayDate because no one would have punched-in or out on the holiday.

Does this make sense?

"Jeff Boyce" wrote:

Keith

It sounds like you are saying that you want to see each employeeID and each
date (on the "PunchTime" table), plus the time in/out if the date is not a
holiday, and the holiday's name if it is.

Note that I'm assuming that your punchtime table contains DATES as well as
times...

If that's an accurate paraphrase, then one approach would be to:

1. create a new query
2. add both tables
3. put the punchtime table fields in the output of the query
4. add one more output field to the query, containing something like
(untest):

HolidayName: IIF(PunchDate = HolidayDate, [HolidayName], "")

You'd need to adjust this to match your fieldnames...

Good Luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Keith" wrote in message
...
I have two tables - Employee_PunchTime table and Holidays Table. The
PunchTime table contains three fields representing EmployeeID, Time-in and
Time-out; and the Holiday table contains two fields representing name of
holiday and the date.

If the payroll period is 5/31/2010 (Mon) thru 6/4/2010 (Fri) and 5/31/2010
is a paid holiday, I need to create a query that shows punched time and
paid
holiday on a separate column.

On the paid holiday, there would obviously be no Time-In and Time-Out
record.

It will look something like this:

EmpID Date Time-in Time-out Paid Holiday
------- ---- -------- --------- ------------
1001 5/31/10 Memorial Day
1001 6/01/10 9:00 am 6:00 pm
1001 6/02/10 9:00 am 6:00 pm
1001 6/03/10 9:00 am 6:00 pm
1001 6/02/10 9:00 am 6:00 pm

Any suggestions?

Thank you.

Keith



.