Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cr Reporting with Visual Basic

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a Visual Basic 5.0 application that has 1 report under it.
The version of cr is 4.6..

The problem is that when i have tryed the Sql statement from Crystal Reports it works fine But when i pass it through Vb it does not find the data that is required?

The code i am writing is the following:

With frmPersonnel.CrystalReport1
.ReportFileName = App.Path & "\Test.rpt"

.WindowTitle = "Test Report"


If Me.lstName.Text <> &quot;&quot; Then


.SqlQuery = &quot;SELECT tblDisipline_history.Personnel_Name From tblDisipline_history WHERE tbldisipline_History.Personnel_Name &quot; = frmPersonnel.lstName.Text
.Destination = crptToWindow
.PrintReport

Exit Sub
End If


End With


hope you can help with this.

Many thanks
Stephen Rattray..
 
How about:

.SqlQuery = &quot;SELECT tblDisipline_history.Personnel_Name From tblDisipline_history WHERE tbldisipline_History.Personnel_Name = '&quot; & frmPersonnel.lstName.Text & &quot;'&quot;
 
Thanks for the advise But
When i entered the Sql then ran the application all the names within the Database still came across??

Thanks Again
Stephen Rattray
 
Make sure, of course, that the &quot;Save Data with Report&quot; menu item is off in Crystal.

A more common way to do things is to create a parameter in the report and passing the value of the parameter from VB, instead of overlaying the entire SQL statement in VB.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top