?
Solved

VB6 -> Crystal Reports: Subreport parameter prompt for link field

Posted on 2005-03-03
5
Medium Priority
?
1,192 Views
Last Modified: 2012-06-21
I've recently upgraded a VB6 application from Crystal 6 to Crystal 10. I'm now having problems running several reports which worked fine with Crystal 6.

The problem reports are those that have subreports (all the others work fine). Here's what happens.

I open a DAO dataset (rsData) and pass this to the main report

Set rsData = gdbHotel.OpenRecordset("SELECT keyItinerary, StartDate <etc ...> FROM tblCustItinerarys WHERE keyFBooking = 1", dbOpenDynaset)

With cryReport
    .Database.SetDataSource rsData
    .Database.Tables.Item(1).SetPrivateData 3, rsData
End With

I then do the same for the subreport.

Set rsDataGuest = gdbHotel.OpenRecordset("SELECT keyFItinerary, Title, Forename, Surname FROM tblCustGuests WHERE keyFBooking = 1;, dbOpenDynaset)

   For Each crSec In cryReport.Sections
        For iCount = 1 To crSec.ReportObjects.Count
            If crSec.ReportObjects.Item(iCount).Kind = crSubreportObject Then
                Set crSub = crSec.ReportObjects.Item(iCount)
                If crSub.SubreportName = "Guests" Then
                    Set crySubReport = crSub.OpenSubreport
                    crySubReport.Database.Tables.Item(1).SetPrivateData 3, rsDataGuest
                End If
            End If
        Next
    Next

(Code isn't particularly efficient, but it's always worked)

In this example the main report has a list of itineraries (the report is per itinerary), with the primary key: keyItinerary. This links to the Guests subreport on the field keyFItinerary. So the report has the link correctly established, and if you run the report in Crystal it works fine.

When you run it in VB, however, it prompts for the subreport parameter (Pm-dao.keyFItinerary) that the link is based on. If you give it a value, the report opens. The main body of the report is fine, but the sub-report will only have data for the value of keyItinerary that was manually input at the prompt. So, if the report has multiple pages, only one page will be correct. I'm passing the Guests subreport the correct data, it has all values of keyItinerary that could possibly be needed based on the data i'm passing the main report.

Hope that's clear ... it's early so i've done my best!

Any questions, let me know.
0
Comment
Question by:jonnyboy69
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Expert Comment

by:Spykair
ID: 13447694
Johnnyboy,

When linking your subreport, do you link it on "?@keyFItinerary" or "?Pm-?@keyFItinerary". It should be "?@keyFItinerary".

Hth,
Spykair
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 13449345
Crystal changed the interface with CR9 and 10.
Look at these examples

http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_win_samples.exe.asp

mlmcc
0
 

Author Comment

by:jonnyboy69
ID: 13465122
Thanks for your help. I'd already checked that Spykair, but thanks again. The reports were working fine both with the v6 viewer and within Crystal (regardless of version).

And thanks mlmcc. I did have to make a couple of code changes to get them running in the first place, but nothing that caused/affected this problem, so I don't think it was related to interface changes.

I can only think it's a problem with running v6 reports within the v10 viewer as i've rebuilt the reports from scratch, EXACTLY the same ... and now they're running fine.

Will get the topic closed now ...

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 13509878
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question