I'm creating a Timesheet database and I'm having trouble with the time entry form as follows:
There is a main form called "F: Timesheet" with a sub-form called "F: Timesheet Detail" they have linked fields "Initials" and "Week Commencing" (a date field). The main form has just these two fields and a "Completed" check-box. The sub-form has a "Day" field ("Mon", "Tue" etc.) and a "Days" field (numerical - i.e. 1 day, 0.5 days etc), as well as fields for the project phase and task they worked on. Because there will be multiple tasks there may be more than one line for each day. At the bottom of the form (I don't really care if it's the main or sub-form), I want a total for each day, so users can see if they've allocated all their time for each day.
I've tried DSum in all sorts of ways but just keep getting an #Error message. Here's one attempt (eg. to sum Monday): =DSum("[Days]","F: Timesheet Detail","[Day]='Mon'").
At one stage, I thought it was working, when I pointed it to the underlying table, but it was summing all instances of "Mon" in the table, not just for the week in the timesheet. When I tried to restrict this as follows, I just got #Error again: =DSum("[Days]","Timesheet Detail","[Day]='Mon' And [Week Commencing]=forms![Timesheet]![Week Commencing]").
I'm afraid the syntax for DSum has me completely stumped. Any assistance would be greatly appreciated.
Note: I am using Access 2003
Cheers,
Marc
There is a main form called "F: Timesheet" with a sub-form called "F: Timesheet Detail" they have linked fields "Initials" and "Week Commencing" (a date field). The main form has just these two fields and a "Completed" check-box. The sub-form has a "Day" field ("Mon", "Tue" etc.) and a "Days" field (numerical - i.e. 1 day, 0.5 days etc), as well as fields for the project phase and task they worked on. Because there will be multiple tasks there may be more than one line for each day. At the bottom of the form (I don't really care if it's the main or sub-form), I want a total for each day, so users can see if they've allocated all their time for each day.
I've tried DSum in all sorts of ways but just keep getting an #Error message. Here's one attempt (eg. to sum Monday): =DSum("[Days]","F: Timesheet Detail","[Day]='Mon'").
At one stage, I thought it was working, when I pointed it to the underlying table, but it was summing all instances of "Mon" in the table, not just for the week in the timesheet. When I tried to restrict this as follows, I just got #Error again: =DSum("[Days]","Timesheet Detail","[Day]='Mon' And [Week Commencing]=forms![Timesheet]![Week Commencing]").
I'm afraid the syntax for DSum has me completely stumped. Any assistance would be greatly appreciated.
Note: I am using Access 2003
Cheers,
Marc
Last edited: