Parsing parameter from VB 6.0 to Crystal Report 7.0 
Author Message
 Parsing parameter from VB 6.0 to Crystal Report 7.0

Hi...
I have some questions.
1. How to parsing parmaeter from VB to CR 7.0, if I already have a
report in CR 7.0.
Example: I have one command button in VB application and I  want to
show  report in CR 7.0 only field with value "PO"

2. How to insert page break in detail section, if the line number has
already ten lines? So the rest must be in the new page ?
Example : I have the query result : 13 records.
I want the first page is 10 records and the rest in the new page.

Thank's in advance.
Regards,

Tammy



Sat, 10 Sep 2005 10:06:56 GMT  
 Parsing parameter from VB 6.0 to Crystal Report 7.0
Hi Tammy,
    I use CR7 with the ActiveX control.  I have had trouble passing
parameters to a report.  What I have done to get around this problem is to
create a new query, which includes a "where" clause using my restrictions,
and set the "SQLQuery" property to my new query.  The second problem I would
solve by inserting a formula into the details section that uses a variable
counter:  counter := counter + 1
You may need to reset the variable in a page footer.  Format the details
section to have a "new page after" based on the value of the counter
variable. (counter = 10)

Bob Holmes


Quote:
> Hi...
> I have some questions.
> 1. How to parsing parmaeter from VB to CR 7.0, if I already have a
> report in CR 7.0.
> Example: I have one command button in VB application and I  want to
> show  report in CR 7.0 only field with value "PO"

> 2. How to insert page break in detail section, if the line number has
> already ten lines? So the rest must be in the new page ?
> Example : I have the query result : 13 records.
> I want the first page is 10 records and the rest in the new page.

> Thank's in advance.
> Regards,

> Tammy



Sat, 10 Sep 2005 22:14:54 GMT  
 Parsing parameter from VB 6.0 to Crystal Report 7.0
Hi Bob,

Thank's for your answer.
Can you help me, how to make a new query in CR 7.0, so I can call the
property sqlquery from my vb application ?
Thanks.



Sun, 11 Sep 2005 09:35:32 GMT  
 Parsing parameter from VB 6.0 to Crystal Report 7.0
Hi Tammy,
    I use the ActiveX control and my code looks like this:

'Users choose from several reports listed in a menu option
Public Sub ViewReports(IndexNumber)
    Dim strReportName As String
    Dim strParameter As String
    Dim strQuery As String

    strParameter = "Summary"

'I use the same report to offer either a summary view or a detailed view of
the data and the user chooses
'items from a drop-down list to restrict the data.  Based on which report
the user has chosen, a routine is called to
'determine which items from the drop-down the user chose.
  'Determine which contact(s) or section(s) the user has chosen from the
drop-down
    Select Case IndexNumber
        Case 0, 1, 2
            If boolAllSelected = False Then frmOutput.CollectSections
            If boolNoSelection = True Then Exit Sub
            strReportName = IIf(intIndex = 2,
"ContactsBelongingToSectionByCompany.rpt", "ContactsBelongingToSection.rpt")
            If intIndex = 0 Or intIndex = 2 Then strParameter = "Detail"
        Case 3
            strReportName = "ContactsByCompany.rpt"
        Case 4
            If boolAllSelected = False Then frmOutput.CollectAddresses
            If boolNoSelection = True Then Exit Sub
            strReportName = "SectionsForContact.rpt"
        Case 6
            strReportName = "Residency Report.rpt"
        Case 7
            strReportName = "Sections.rpt"
    End Select

  'Pass the appropriate report file name to the Crystal Report object
    frmOutput.CR.ReportFileName = strReportPath & strReportName

  'Create the required query to send to the report object so that it will
display the desired data
    With frmOutput.CR
        Select Case intIndex
            Case 0, 1, 2
              'Passing a parameter requires three pieces of information:
Name of parameter, the parameter value
              'and "True" to prevent the user from being prompted
                .ParameterFields(0) = "Report_Type;" & strParameter &
";True"
                If boolAllSelected = True Then
                    .SQLQuery = "Select * From Addresses RIGHT JOIN
Section_Members ON " & _
                            "addresses.address_id =
section_members.address_id RIGHT JOIN Sections ON " & _
                            "section_members.section_code =
sections.section_code " & _
                            "Where sections.section_code <> " &
SQLQuote("ZZ")
                Else
                    .SQLQuery = "Select * From Addresses RIGHT JOIN
Section_Members ON " & _
                        "addresses.address_id = section_members.address_id
RIGHT JOIN Sections ON " & _
                        "section_members.section_code =
sections.section_code " & _
                        "Where sections.section_desc in " & strSelection
                End If
            Case 4
                .ParameterFields(0) = ""
                If boolAllSelected = True Then
                    .SQLQuery = "Select * From Addresses LEFT JOIN
Section_Members ON " & _
                            "addresses.address_id =
section_members.address_id LEFT JOIN Sections ON " & _
                            "section_members.section_code =
sections.section_code"
                Else
                    .SQLQuery = "Select * From Addresses LEFT JOIN
Section_Members ON " & _
                        "addresses.address_id = section_members.address_id
LEFT JOIN Sections ON " & _
                        "section_members.section_code =
sections.section_code " & _
                        "Where addresses.address_id in " & strSelection
                End If
            Case 7
                .ParameterFields(0) = ""
                .SQLQuery = "SELECT Sections.section_code,
Sections.section_desc, " & _
                            "Section_Members.section_code From " & _
                            "Sections LEFT JOIN Section_Members ON " & _
                            "Sections.section_code =
Section_Members.section_code "
              'Set the specified subreport as the target of property changes
                .SubreportToChange = "sections_subreport"
                .SQLQuery = "SELECT Sections.section_code,
Sections.section_desc, " & _
                            "Section_Members.address_id From " & _
                            "Sections LEFT JOIN Section_Members ON " & _
                            "Sections.section_code =
Section_Members.section_code "
            Case Else
                .SQLQuery = ""
                .ParameterFields(0) = ""
            End Select

        .WindowAllowDrillDown = False
      'Connect to the database through an ODBC connection via a system DSN.
Send the report to the
      'user's screen and maximize the window
        .Connect = "DSN=" & strServer & ";UID=;PWD=;DSQ=" & strDatabase
        .Destination = crptToWindow
        .WindowShowGroupTree = True
        .WindowShowSearchBtn = True
        .WindowShowPrintSetupBtn = True
        .WindowState = crptMaximized
        .PageFirst
        .Action = True
    End With
  'Set the main report as the target of property changes
    frmOutput.CR.SubreportToChange = ""
    frmOutput.CR.Reset
End Sub

I hope this helps

Bob Holmes


Quote:
> Hi Bob,

> Thank's for your answer.
> Can you help me, how to make a new query in CR 7.0, so I can call the
> property sqlquery from my vb application ?
> Thanks.



Sun, 11 Sep 2005 22:38:02 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VB 6.0, Crystal Reports 7.0, Access 97 - error

2. Actualizar la Informacion en un Reporte Crystal Reports 7.0 desde VB 6.0

3. Crystal Reports 7.0 and VB 6.0 Dependency files

4. WHERE IS THE CRYSTAL REPORT 6.0 o 7.0?

5. Crystal Report 6.0 and 7.0

6. How to get the Crystal Report ver 7.0 or 6.0

7. How to get the Crystal Report ver 7.0 or 6.0

8. How to get the Crystal Report ver 7.0 or 6.0

9. VB 6.0 reports vs. Crystal 6.0

10. VB 6.0 and Crystal Reports 6.0

11. VB 6.0 reports vs. Crystal 6.0

12. Vb 6.0 Printer dialog box and Crystal 7.0 Print Preview

 

 
Powered by phpBB® Forum Software