Data Designer: Unable to group (newbie question)
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:
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"
And defined the fields in my code like that:
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"
This generates the following report:
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
But what I really want is to group the times per username. How can I do this? Thanks for your guidance.
PS: I'm using the classic VB6
Re: Data Designer: Unable to group (newbie question)
Right-Click in any section within the data report and select the Insert Group Header/Footer menu item.
Add a TextBox control into the new Group Section and set it's DataField property to UserName. It's DataMember property must be left empty.
Re: Data Designer: Unable to group (newbie question)
Hi,
Great! Worked like a charm. I already had a group header in but it wouldn't work because I didn't leave the datamember field empty!
Thanks m8! Can't believe I was struggling with this for so long... :-)