Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataReport Grouping

Status
Not open for further replies.

L0stAngel

Programmer
May 5, 2005
58
US
Hi, i've got the following code that allows me to to have a database field display in the reports "Group Header", and also fields in the details.

Code:
strSQL = "SHAPE {"
 strSQL = strSQL & "SELECT * "
 strSQL = strSQL & "FROM tblMaintenanceRequests "
 strSQL = strSQL & "WHERE DateInitiated "
 strSQL = strSQL & "BETWEEN #" & strTo & "# "
 strSQL = strSQL & "AND #" & strFrom & "# "
 strSQL = strSQL & "ORDER BY EquipmentType} "
 strSQL = strSQL & "AS Command1 "
 strSQL = strSQL & "APPEND ({ "
 strSQL = strSQL & "SELECT * "
 strSQL = strSQL & "FROM tblMaintenanceRequests} "
 strSQL = strSQL & "AS Command2 RELATE 'MaintenanceRequestID' "
 strSQL = strSQL & "TO 'MaintenanceRequestID') AS Command2 "

The problem is, it's not actually grouping all EquipmentTypes (ie: (None)) together, and listing the details below it. Belows a picture of how it's doing it (TOP) compared how it should look (BOTTOM)
ScreenShot0092.jpg


I guess it wouldn't hurt if I explained a little bit more on what i'm looking for. Say theres 4 Equipment IDs. Each of these EquipmentIDs are connected to an EquipmentType (in the DB, theres a row with Type = (None), ID = 12, Details = blah blah blah. Another row has Type = (None), ID = 12, Details = Blah Blah Blah. When I run the report, since these share the same Type, they look like the below where it mentions (None). Now in yet another row, I have a Type = Dryer, ID = 13, Details = blah blah...and another row has Type = Dryer, ID = 14, Details = Blah Blah Blah...since these share the same Type, They are listed below the EquipmentType group, but since their ID is different, they are shown one level down as the second example below shows.

EquipmentType: (None)
EquipmentID: 12
Details...Details...Details...Details.... **this rows has an equipmentid of 12**
EquipmentID: 12
Details...Details...Details...Details....**This ones equipmentid is 12 too**
--------------------------------------

EquipmentType: Dryer
EquipmentID: 13
Details...Details....Details....Details....**This rows EquipmentID is 13**
--------------------------------------

EquipmentID: 14
Details...Details....Details....Details....**This ones is 14**
 
Have you tried RELATEing equipmentID instead of maintenanceID, or maybe both?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top