I’m creating a database of time spent weekly on a project by an engineer.
I have a multiple items form “frmhrsweeklyinput “ with bound textboxes from a query "qryHrsWeeklyInput" in the detail section of the form ”task” “week1” “week2” “week3” “week4” “week5” then at the end I want to add these values together to give a total for January in an unbound textbox (M1). When the form is in form view it shows about 12 tasks in all.
Task is a text field, week1-5 are number fields
In the header I have a textbox with the “year” and command button with an “on click“ event to a select case in VBA.
The problem is that I get the same results for each task.
ie the result of week1-5 for task 1 shows in the results for task2 -12 regardless of what is in week1-5 for each task, does that make sense?
If I put the dsum in the control source of “M1” it works for all tasks but then I won’t have the select case for different years.
Im not an expert as you can see, just been asked to take an excel spreadsheet and put in access.
Cheers
I have a multiple items form “frmhrsweeklyinput “ with bound textboxes from a query "qryHrsWeeklyInput" in the detail section of the form ”task” “week1” “week2” “week3” “week4” “week5” then at the end I want to add these values together to give a total for January in an unbound textbox (M1). When the form is in form view it shows about 12 tasks in all.
Task is a text field, week1-5 are number fields
In the header I have a textbox with the “year” and command button with an “on click“ event to a select case in VBA.
Code:
Private Sub Command228_Click()
Select Case Me.Text214
Case "2010"
M1 = DSum("[Week1]+[Week2]+[Week3]+[Week4]+[Week5]", "qryHrsWeeklyInput", "[Projects]='" & Forms![ frmhrsweeklyinput]![Task] & "'")
Case "2011"
M1 = DSum("[Week1]+[Week2]+[Week3]+[Week4]", "qryHrsWeeklyInput", "[Project]='" & Forms![ frmhrsweeklyinput]![Task] & "'")
End select
End sub
ie the result of week1-5 for task 1 shows in the results for task2 -12 regardless of what is in week1-5 for each task, does that make sense?
If I put the dsum in the control source of “M1” it works for all tasks but then I won’t have the select case for different years.
Im not an expert as you can see, just been asked to take an excel spreadsheet and put in access.
Cheers