Apr 9th, 2000, 10:56 AM
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
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