Results 1 to 2 of 2

Thread: VB6, SP3, Crystal Reports HELP!

  1. #1
    Guest
    I've wasted an entire three days trying to get this done. I hope someone can help me.

    Situation:
    I need to create a line graph from a csv file.

    I have a csv file called "stats.csv" containing four fields: agent, start_date, start_time, and data.

    I used the ODBC Data Source Administrator to create a User Data Source text file source using the MS Text Driver.

    I then created a line graph report called txt1.rpt using CR V4.6.1.0 which came with VB6. When I test the selection formula while designing the report, all works as I want. I removed all selection formula and saved the report.

    I now create a VB app. On the form I added a Crystal Reports control named cr1. When I click on the action to create the report, I use the following code.

    cr1.ReportFileName = "C:\Stats\txt1.rpt"
    cr1.Destination = crptToWindow
    mintResult = cr1.PrintReport
    If mintResult <> 0 Then
    mstrErr = Get_CR_Error(mintResult)
    MsgBox mstrErr, vbOKCancel, "Report Error"
    End If

    The report is sent to a window, however the data displayed is what I ran my last selection on when I was designing the report...even though the selection code is no longer in the form.

    When I change the code to:
    cr1.ReportFileName = "C:\Stats\txt1.rpt"
    cr1.Destination = crptToWindow
    cr1.SelectionFormula = "{stats_txt.agent} like '1059*'"
    mintResult = cr1.PrintReport
    If mintResult <> 0 Then
    mstrErr = Get_CR_Error(mintResult)
    MsgBox mstrErr, vbOKCancel, "Report Error"
    End If

    I get the following error:

    20527: SQL Server Error. There is a problem connecting with the SQL server.

    Can someone help me get this working? Thanks

  2. #2

    Shot in the dark

    I think there is an option in CRW on the File menu called, Save Data with Report. It's a check box. Uncheck it. Then try. (For your first problem)

    (For the second problem) I'm not sure.

    It's been a while. hope this helps.
    Senior Systems Architect/Programmer

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