Results 1 to 6 of 6

Thread: Crystal Report In VB

Threaded View

  1. #1

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Crystal Report In VB

    Hi all
    Often user get problem when they make setup of the VB project using the crystal report.
    Report will be not display at the other Pc where crystal report is not installing.

    1) How to use the crystal report
    Make the report it is batter fro you that you make it using the DSN with the database.
    For making the run time DSN you can use the code given by me in the VB
    Code Bank in the General problem for the new user, See my Signature.

    Open the Project Add the crystal report control

    Right click on this control and set the property.

    Report for the string value in the database

    VB Code:
    1. Private Sub Command1_Click()
    2. 'Report With String
    3. Dim S As String
    4. S = "{Table.Field}='" & Text1.Text1 & "'"
    5. With CrystalReport1
    6.     .ReportFileName = App.Path & "\ReportName.rpt"
    7.     .SelectionFormula S
    8.     .Action = 1 'Will Show The Report
    9. End With
    10. End Sub

    Report for the integer value in the database

    VB Code:
    1. Private Sub Command1_Click()
    2. 'Report With Number
    3. Dim S As String
    4. S = "{Table.Field}=" & Text1.Text1 & ""
    5. With CrystalReport1
    6.     .ReportFileName = App.Path & "\ReportName.rpt"
    7.     .SelectionFormula S
    8.     .Action = 1 'Will Show The Report
    9. End With
    10. End Sub

    Report when there is mix of number and the integer in the condition

    VB Code:
    1. Private Sub Command1_Click()
    2. 'Report With Number and string
    3. Dim S As String
    4. S = "{Table.Field}=" & Text1.Text1 & " and {Table.Field}='" & Combo1.Text & "'"
    5. With CrystalReport1
    6.     .ReportFileName = App.Path & "\ReportName.rpt"
    7.     .SelectionFormula S
    8.     .Action = 1 'Will Show The Report
    9. End With
    10. End Sub

    For removing the error at the client Pc add the Dll database.dll, crystal32.ocx,p2sodbc.dll
    You can change the selection formula according to above condition
    Here table is the TableName
    Field is the Table Field
    Report Is the Crystal Report Name

    Last edited by shakti5385; Oct 7th, 2006 at 08:21 AM. Reason: Add VBCODE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width