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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confusing Query?

Status
Not open for further replies.

palgya

Technical User
Sep 3, 2002
34
US
Hello all, Was hoping that someone could help me out on this. I have a database that tracks PTO (paid time off) for our department. Each time a holiday arrives I have to manually enter 8 hrs to subtract from everyone's pto. I would like to create a query to automatically run when these certain dates arrive or when I choose to run it. The trick is that each entry must be a new record for tracking purposes. Also there is some records that I don't want to update because they are on a different scale. So I assume that an append or update query would not work in this case but I could be wrong. This explaination might be vague and I apologize for that so if you need anymore info please let me know. Thanks to anyone that can give some direction.
p
 
there isn't any information here to help you write your query, but you do say that manually enter 8 hours, for which you add a record. If this is the case then you want to use an append query. To avoid adding the record for people on the wrong scale, you would enter some criteria to that effect. sorry I can't be more helpful with the info provided. if you need more help please post your db structure and some ifo about the criteria.
 
benjamenus, thanks for replying. Told you it was vague. Anyway, what I need to do is add individual records for that 8 holiday hrs. But for each employee, who has many entries in the table which coincides with pto that they have taken. What kind of criteria would I use to specify individual employees? or could I just use the employee table? Maybe I just answered my own question. This is very hard to explain. Any suggestions would be greatly appreciated.
p
 
Something like:
Insert into HolidayTable (holDate,HolEmp,Hours)
Select Date(),EmpID,8 from EmployeeTable

This inserts one record for each employee, the current date, and value of 8 for hours. Adjust it as you need, ie, adding where clauses, etc,
--Jim
 
If I've got this right, you don't need to insert a record for every employee - just those on a certain scale. Sounds like you do need to use the Employee table, does this record their current grade? If so you could use the SQL as suggested above but include something like

WHERE EmpID in
(
SELECT EmpID
FROM EmployeeTable
WHERE EmpScale = "Junior"
);

other options

WHERE EmpScale IN ("Junior","Senior")

WHERE EmpScale <> &quot;Manager&quot;

etc - I'm sure you get the idea :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top