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!

Can't Filter/Sort after SetTablePrivateData

Status
Not open for further replies.

BobWman

Programmer
Jan 7, 2002
169
US
My project is using VB6, Crystal Reports 8 and SQL Server 2000. I am creating and updating a Temp Table thru VB, then connecting the Temp Table to my report using OCX, Active Data and SetTablePrivateData. This works OK!

However, I want to apply Filter and Sort after connecting report to the Temp Table. For example:
CR1.SortFields(0) = +{##BHPCD6A6586.Contract}

I receive the error that "This field name is not known". The field is valid in the Temp Table, so I assume that CR is choking on the Temp Table part of the Sort.

Can Sorts/Filters be applied like this when using Active Data reporting?
 
Are you passing a recordset to the report from the app, or is the report reading the temp table directly? It appears that your report is getting a recordset, so using the temp table name is not going to help. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
This is the code which ties the recordset to the report:

' mrstData is using the temp table we created.
' It must be open when this method is called.
' Tie this recordset to the OCX
crpModification.SetTablePrivateData 0, 3, mrstData

After executing the SetTablePrivateData statement, I try to filter:

crpModification.SelectionFormula = {##BHPA0OA6586.ChangeStatusCode}='C'

This causes the error when attempt to print the report.

 
You might be able to do what you are trying to do, but it makes more sense to apply the filter to the RS and then pass the modified RS to the report.

If you must pass a field name to the report, it must be the field name as seen by the report, not the temp table.
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top