Hi,
I'm new to building reports. I've gotten to a point where I want to group the results, but can't seem to figure out how it works. I've spent 2 hours searching on this and can't seem to get it to work.
This is what I got so far:
I've read that I need to use Shape. So I altered my SQL command to the following:
And defined the fields in my code like that:Code:"SHAPE{SELECT UserName,LogInDate,LogInTime,LogOutDate,LogOutTime FROM " & strTable & " WHERE LogInDate BETWEEN #" & strFromDate & "# AND #" & strToDate & "# ORDER BY [UserName]}" & "AS SQL1 COMPUTE SQL1 BY UserName"
This generates the following report:Code:DataReport1.Sections("section1").Controls.Item("Text1").DataField = "LogInDate" DataReport1.Sections("section1").Controls.Item("Text1").DataMember = "SQL1" DataReport1.Sections("section1").Controls.Item("Text2").DataField = "LogInTime" DataReport1.Sections("section1").Controls.Item("Text2").DataMember = "SQL1" DataReport1.Sections("section1").Controls.Item("Text3").DataField = "LogOutDate" DataReport1.Sections("section1").Controls.Item("Text3").DataMember = "SQL1" DataReport1.Sections("section1").Controls.Item("Text4").DataField = "LogOutTime" DataReport1.Sections("section1").Controls.Item("Text4").DataMember = "SQL1" DataReport1.Sections("section1").Controls.Item("Text5").DataField = "UserName" DataReport1.Sections("section1").Controls.Item("Text5").DataMember = "SQL1"
But what I really want is to group the times per username. How can I do this? Thanks for your guidance.Code:Username: Login Date: Login Time: Logout Date: Logout Time: User 5/02/2008 13:30:00 5/02/2008 16:00:00 User 5/02/2008 7:00:00 5/02/2008 12:00:00 User 2/02/2008 9:00:00 2/02/2008 17:00:00 User2 4/02/2008 10:00:00 4/02/2008 18:00:00 User3 3/02/2008 8:30:00 3/02/2008 16:30:00
PS: I'm using the classic VB6




Reply With Quote