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

Subreport selecting all records from query

Status
Not open for further replies.

jrtex

Programmer
Dec 7, 2000
11
US
I have created a report with account info. Within that report I have created a subreport that will select certain contact info based on the account id. Problem I am having is that it is pulling all the records from the subreport query and putting it with each account. Also, since I am calling it from VB the parameter field box keeps popping up with the field that I had used for a link between the container report and subreport. I'm assuming I can pass something to the report so that the box does not pop up for the parameter. How to get only the records I need for a specfic account is the big issue. Any ideas or suggestions would be appreciated.
 
Ok, I found the option to turn off the prompt for the subreport parameter but I still can't seem to get the subreport to only show data related to each seperate account. If I create a new report using an ODBC link to the tables and do a simple link it works fine but when I the report from VB using TTX files for the database link I get all the records from table 2 going with each account from table 1. Thanks for any suggestions
 
can you not link the subreport to the main report by Account

then the record selection formula in the subreport should filter out the unwanted values...sounds to me you have an unlinked subreport
 
Thanks for the response. Well, I just went back and recreated the report again from scratch. I created the TTX files for the 2 tables. I then created the report. After adding a few fields from the first table I then added a subreport using the report expert. I selected the the ttx file for the subreport. I added a few fields. Before I finished I clicked on the "link" tab and clicked on the account id from the account table(table 1) which then created a parameter which linked to the subreports account id. Saved the report, reran the VB code and still get the same results, all the records in subreport come up for each seperate account.

As I noted in a previous post I can do it without any problem if I just create the report using an odbc link to the 2 tables, although I do not call the report from VB, I can just do a print preview and see it works. ODBC is not an option for me to use anyways but wanted to make sure the subreports worked, which of course they do.

Is there something I have to pass from VB to change the selection of records? Both my queries that I pass to crystal are pretty simple(ex... select * from table order by account). Is it something with using active data connections that needs to be changed? TTX file issues?

Thanks for any info
 
I'm not sure about how you are doing this. But in the Record selection formula of the subreport you should see something like

{table.AccountID} = {?PM - AccountID} and

where {?PM - AccountID} is the parameter link created when you linked the subreport to the main report. This Record Selection formula will do the filtering for you.

I know that you are launching this from VB and I am weak in this area but you must be doing something like that.
 
This is record selection formula:

{ttnames_ttx.ACCT_ID} = {?Pm-ttmaster_ttx.ACCT_ID}

All that seems fine since if I change the database location to ODBC and point directly to the database tables it works just fine. The problem I'm having is that since I am using a different database connection(Active Data, Field Definitions Only) with the ttx files I created to match the 2 tables it somehow does not care about the link. I am stumped as to what I must either pass from VB or maybe another option within Crystal itself.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top