Controlling subform record from list box

R

ryan_eng

Hey people,
This one has got me stumped.

I've created a time tracking portion in my database. It is based on two
tables:

tbl_Time_Tracking
-Time_Track_ID
-EmpID
-Date

and

tbl_Time_Tracking_Details
-Time_Track_ID
-Time_Track_Detail_ID
-Job_No
-hours
-a few other detail fields

My form and subform combo for entering time only show one day at a time. My
boss isn't too crazy about that. He would rather have the entire week at a
glance.
If anyone has any ideas on how to approach this I'd love to hear it. For now
this is my solution:

I have a list box next to the subform populated with the days of the week
("Monday", "Tuesday" etc). On the main form you select the employee and the
week (restricted to selection of fridays, i.e end of week). Depending on the
selection in the list box, I would like to either display the time entries
for that day, or create a new record for that day if none already exists. In
either case more entries can be made.

So far I have programmed the week selection and started programming in the
"after-update" event of the list box with a "SELECT CASE" statement. I'm not
sure how to do the rest but the logical process would be:

1. based on the week day selection and the week chosen, calculate the actual
date (easy,done)

2. search through tbl_Time_Tracking_Details to see if there is already an
entry for the selected employee on the selected day and if there is, return
the Time_Track_ID and set the subform to display those records.

3. If no Time_Track_ID exists, create a new entry and set the subform up for
data entry on that record.

So thats my plan. If any of you experienced folks have done this kind of
thing before I'd love to hear your input. I'm not stuck on this plan, its
just the best solution I can think of.

Best regards
Ry
 
Top