form, subforms and more subforms!

Maybe if you tell me what the purpose of your timesheet entries table is for we might be able to come up wth a solution?

Also what are the CostCentre and TotalHours fields for?
 
okay, so every employee enters a timesheet at the end of each week on a customized excel sheet(im trying to replace this with a database). What needs to be recorded is each job worked on over the week including how many hours was spent on that job. The total hours simply adds the hours worked on the job and creates a total.

Does this help?
 
Then your setup is just about right but needs a bit of tweaking. I think it's the TimesheetNumber in the 2nd subform that is confusing you. Are employees supposed to type in a timesheetnumber or is it supposed to be automatically generated?

Have a look at the attachment and you would have a better idea of how your database should be designed. The concept is it automatically generates the timesheet number. If your Timesheet has timesheet number on it then your timesheet entries form wouldn't need that displayed.
 

Attachments

This helps a whole lot, although Employees should be able to access different weekly timesheets, as in ..timesheets they have created in the past.

I enabled Timesheet number and changed the autonumber to a number so a user could access the timesheet number. I guess you can say timesheet number is the same thing as saying weekly timesheet.

The problem remains.
If I wanted to see week 1 of one employee, it would have the same information as week 1 of a different employee..somehow the information should store and refresh for every employee. Is this possible?
 
You can but you would need to create a query based on all three tables (putting the relevant fields that you wish to see) and group by the WeekNumber field. Or set the criteria to pick week number. This is where things could get complicated.

Try creating that query and post back on progress.
 
sorry vbaInet, I am confused. Do you mean create a large query with fields from all 3 tables? I'm not sure how to set the criteria to pick a certain field..do I set the criteria for all fields in the query?
 
Create a query including only the fields you need to see from all three tables. For example you could use only Timesheets and Employees table to accomplish the following. Perhaps you want a broadsheet showing each week and all employees that worked that week with their hours, you would need Employees Surname and Forename from Employees table, Hours worked and Week Number from Timesheets table as basic. However if you wanted to see specific details about a particular employee's timesheet, then you would then include fields from your Timesheet details table.

Are you getting the idea?
 
Okay I created the query, but im not sure what you meant by setting the criteria to pick the weeknumber or group the weeknumber field?
 
Yes, in that field under the Criteria row (in design view). You could put a number that corresponds to that week number and it will filter for just that record when you open it in Datasheet view. Try it out.
 
I now understand the criteria aspect and if I type week 1 in the query, it querys the table for me. However how can I query it further to display a certain employee? I'm getting dreadfully confused, shouldn't we need to query according to employee and then according to weeknumber?
Do I use this one query for an entire form, ie. no subforms? :(
 
Last edited:
It's up to you as to what information you want to see. If you want to view a specific employee, what is the field that is unique to an employee? I'm sure you know this one :)

The form you created is for entering timesheets on a regular basis. You can create another form that is based on that query.
 
nevermind vbaInet!!, I played around with my relationships and got it to work!! Every employee can now see their weekly timesheet and it's different from other employees. I can't explain why it's working though, I guess some accidents lead to success:)
 
I hope you can explain it to me, and if it's okay..I created two relationships using two tables and I played around with the subform link with the subsubform link..I made it have two links rather than one.
Do let me know!
 

Attachments

See attached. Open up your Timesheet table and look at the last two records. Do the same for the entries table too. Tell me what you think.
 

Attachments

  • Like
Reactions: SOS

Users who are viewing this thread

Back
Top Bottom