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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping field in VB DataReport

Status
Not open for further replies.

sdb510

Programmer
Oct 10, 2000
38
0
0
US
I have a VB DataReport that looks something like:

Report Group Header
Insurance Group Name Insurance Group Number

Report Detail
Company Name Address No. Employees Etc.


There are multiple companies per Insurance Group.

I currently have a command defined in the DataEnvironment to run this report, which I modify dynamically when the program runs. This command is called cmdGrp, and is grouped by cmdGrp_GrpNm.
The DataMember of the report is set to cmdGrp_GrpNm.

The source for cmdGrp_GrpNm is currently being defined as:
SHAPE{ Select GrpNm, GrpNb, CompNm, ... from GrpReport} AS cmdGrp COMPUTE cmdGrp BY 'GrpNb', 'GrpNm'

When I run the report right now, the report displays grouped by Group Number in ascending order.

What I need to do is group by Group Number in descending order.
I have tried SHAPE{...} AS cmdGrp COMPUTE cmdGrp BY 'GrpNb' DESC, 'GrpNm'
to no avail.

When I check out the properties of the command in the DataEnvironment, there appears to be no way in the properties window to specify in which direction the fields of a child command are grouped within another command.

Is there any way to specify this direction, like an ORDER clause in a SQL string (ORDER BY field1 ASC, field2, DESC, etc.)?

Thanks for any help.

Steve [sig][/sig]
 
Steve,
My only thought would be if you could attach the sql string where you could specify ORDER BY GroupNum desc. Perhaps you've tried that already. I actually have a question of you, in regards to a dynamic data report. I have developed some data reports, and thought I had them dynamic, but it only works the first time I run it. The report does not refresh for new criteria, even though the sql string is being read properly. Is there some sort of refresh feature within the data report, so you can respecify the sql string? Any ideas would be appreciated.
Thanks,
Eve [sig][/sig]
 
Eve,

I haven't had a problem with the report refreshing. Here is the code I use to load the report, maybe it will work for you.

Public Sub PreviewReport()

'Use Object type so you can load any report
Dim objReport as Object

'Load report that user selected
Set objReport = GetReport()

If (Not objReport Is Nothing) Then
objReport.Show vbModal
End If

Unload objReport
Set objReport = Nothing

End Sub

My suspicion is that you are not Unloading the report (just because the user closes the report does not mean that it is unloaded), so when the user tries to reload the report, it is just displaying the same one as before.

Hope this helps.

Steve [sig][/sig]
 
Well, I've found no good, or bad, way to do this. Perhaps I'm doing something wrong, or perhaps there's a bug.

Everytime I've set grouping in a Command, Order By always goes by Ascending order even if told Descending. The moment I undo grouping, Order By will go by Descending if that's what I've thrown in. Something else is going on somewhere that is forcing it into Ascending order. Unfortunately, I don't know where, or what, that something is. --
Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top