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

VB->Formula->MainRpt->SubRpt Record Selection

Status
Not open for further replies.

IDoWindows

Programmer
May 18, 2001
14
US
I am passing a string from VB5.0 like this:
CrystalReport1.Formulas(0) = "UID= '" & mvAccountID & "'"

The main report receives the value passed into its formula named @UID.

I have selected my subreport, right-clicked, and Changed Subreport Links...

I selected the formula @UID from the box on the left. I checked "Select data in subreport based on field."

Then I chose the matching field from the database in the drop-down box below the "select" checkbox.

I notice in the drop-down on the left, CR has made a parameter "?Pm-@UID".

After checking the record selection formula for the subreport, I find that it contains the database match-field = CR-generated parameter, like this:

{ESEConfMems.UName} = {?Pm-@UID}

So now, it seems like I'd get the subreport, but it comes up blank...
 
Can you display the formula on the main report?

If you create a second formula in the main report, give it a literal value and link the subreport to this formula does the subreport return records?

If you remove the link and give the subreport a hard coded selection formula does it display?

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
I got it working late last week... I never did get the formula to work when passed to the container report, then linked to the subreport as record selection criteria.

However, when I got my syntax right, I was able to include the criteria as a parameter from VB, then linked to the subreport.

CrystalReport1.ParameterFields(0) = "UID;" & mvAccountID & ";true"

...where UID is the param name in the main report, mvAccountID is the selection criterion (string) from VB, and 'true' to stop the report from going to the user for param input.

Thanks for your attention ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top