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

passing .GroupSortFields from VB to Crystal

Status
Not open for further replies.

Halina

Programmer
Joined
Dec 5, 2000
Messages
6
Location
US
I need help with the Syntax for "GroupSortFields" Below is my code. I get an error: "Invalid Field name"
the name is not invalid. The same name is used and works with the Sortfields option. When I comment out the Sortfields option and just use >groupsortfields, I get the error. HELP!

With repCR1
.WindowState = crptMaximized
.ReportFileName = App.Path & "\shx12.rpt"
.GroupSortFields(0) = "+" & "{" & Psort & "}"
'.SortFields(0) = "+" & "{" & Psort & "}"
.ReportSource = 0
.WindowTitle = "Dictionary ID Report"
.DataFiles(0) = db.Name
.Destination = crptToWindow 'print preview
.Action = 0
End With

 
The best way I have found to debug these is to replace the with clause and spell out all the fields and see which one gives you the error. Once you debug the problem you can put it back into the with clause.
Brett Please visit my websites!
 
Thanks, but is this Syntax correct?

repCR1.GroupSortFields(0) = "+" & "{" & Psort & "}"

 
Review the following:

Group Sort Sample
Code:
For each oObject in oRpt.Areas
   if oObject.Kind = 3 or oObject.Kind = 5 then '3/5=GH
     oObject.GroupOptions.SortDirection=0 '1=Asc/0=Dec
   end if
next

Details Sort Sample
Code:
Set session("Sortfields") = session("oRpt").RecordSortFields
Set newSortfield = session("SortFields").Add(1, "{name.fname}")

Set session("Sortfields") = session("oRpt").GroupSortFields
Set newSortfield = session("SortFields").Add(1, "{name.lname}")

Why am I given all my knowledge away?!? - oh ya for the votes... Steven Fowler, Principal
steve.fowler@fowlerconsulting.com
- Development, Training, and Consulting
wpe1.gif
 
Here is a clean version for others:

Details Sort Sample
Set oSortFields = oRpt.RecordSortFields
Set oNewSortfield1 = oSortFields Add(1, "{name.fname}")
Set oNewSortfield2 = oSortFields.Add(1, "{name.lname}") Steven Fowler, Principal
steve.fowler@fowlerconsulting.com
- Development, Training, and Consulting
wpe1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top