Robkbangor
New member
- Local time
- Today, 01:05
- Joined
- Nov 13, 2012
- Messages
- 3
Hello all!
I've not been able to find anything in the forums to solve this specific problem, but apologies if it has already been covered.
I have a form with two fields, Combo25 used to choose month (as a no between 1 and 12) and YearCombo to year (2012, 2013, etc). I have another field which shows the total of a number (JobSize) specified in records from the query "Completed MRE". To do this, I have bound the field to a Dsum statement which reads as follows:
=DSum("[JobSize]","CompletedMRE","[DateCompleted] >= #01/" & getmonthno(Combo25.Value) & "/" & YearCombo.Value & "# AND [DateCompleted] <= #" & DateSerial(YearCombo.Value,getmonthno(Combo25.Value)+1,0) & "#")
It seems to work apart from one annoying thing - There are two dummy records in the query it looks at, and they both have dates for DateCompleted in November, 2012. If you set the fields on the form for Nov, 2012 it adds them up fine. But it seems to add them up for December 2012 too. All other months (past or future) are fine. It's driving me insane.
Could somebody give me any idea as to why this is happening? Any help would be greatly appreciated
Nb. I am in the UK and so the date format is set to dd/mm/yyyy
Thanks
Rob.
I've not been able to find anything in the forums to solve this specific problem, but apologies if it has already been covered.
I have a form with two fields, Combo25 used to choose month (as a no between 1 and 12) and YearCombo to year (2012, 2013, etc). I have another field which shows the total of a number (JobSize) specified in records from the query "Completed MRE". To do this, I have bound the field to a Dsum statement which reads as follows:
=DSum("[JobSize]","CompletedMRE","[DateCompleted] >= #01/" & getmonthno(Combo25.Value) & "/" & YearCombo.Value & "# AND [DateCompleted] <= #" & DateSerial(YearCombo.Value,getmonthno(Combo25.Value)+1,0) & "#")
It seems to work apart from one annoying thing - There are two dummy records in the query it looks at, and they both have dates for DateCompleted in November, 2012. If you set the fields on the form for Nov, 2012 it adds them up fine. But it seems to add them up for December 2012 too. All other months (past or future) are fine. It's driving me insane.
Could somebody give me any idea as to why this is happening? Any help would be greatly appreciated
Nb. I am in the UK and so the date format is set to dd/mm/yyyy
Thanks
Rob.