Quote:
quote:Originally posted by Bob Hansen
Good catch Steven......now it will only take me a year to break down and understand those additional quote marks. Why are they needed here?
They definitely are not in the sample code that was provided by Microsoft, regerenced by Rood67. And that code works for me. Is there some type of patch/change between versions that may have caused the need for additional quotes? I was doing test with Access 2000, and the samples are titled Access 2000 queries.
|
Bob,
I tried every way possible to get this to work with it being text, but it will not. The M$ example is using a number field, not text. When I altered the table to to be in the form of:
1 Total1 10/04/2004 4
2 Total2 10/04/2004 2
etc...
and used the number field as the DSum "where" clause, it works just fine. So to do the text field, you must use the additional quotes which tells Access that you are using text within text, basically. It's a little more than that, but that's how I remember it.
I would apologize for causing you more confusion, but hopefully this will get you the solution you were looking for.
Rood67
Scott H.
P.S. To get it to pull the date associated with the Total1, Total2, etc... I used this:
SELECT tblTestForForum.Name AS NameA, DLookUp("Date","tblTestForForum","Name <='" & [NameA] & "'") AS TestDate, DSum("Value","tblTestForForum","Name <='" & [NameA] & "'") AS RunTot
FROM tblTestForForum
GROUP BY tblTestForForum.Name;
The reason for the DLookup is that with this query we are using the Totals section, and if you do not do a DLookup and set it to Expression, you would get the Min, Max, Count, etc... and it scews the results. This only becomes a problem if your table will contain:
Total1 10/04/2004 4
Total2 10/04/2004 3
...
Total1 10/06/2004 8
Total2 10/06/2004 6
Which this still isn't perfect, because you get things GroupBy the name Total1, Total2, and it still pulls the first date it comes to. Sorry to open another issue, but maybe you can post if this will be the case, and someone smarter than I can help you work around this.