Loser4Lyf
Mar 1st, 2007, 01:13 AM
grr. CR newbie needs help. i've been through this site a lot and i can't find any sufficient answer to this. here's the scenario.
1. i have a report created using CR8.5
2. in my VB6 project, i have a form which shows a particular item and its related subitems (lets call this frmProperties). i also have a CRViewer form (frmCRView).
3. my database is MS SQL Server 2000.
when i click a 'Preview' button on frmProperties, it loads frmCRView and shows the form i need. i used the code presented here (http://vbforums.com/showthread.php?t=380236&highlight=crystal+reports+tutorial).
however, i can't get the form to show the info i need. all i get is some random info from the database. what i need the form to show is the exact data in frmProperties (the particular item and its subitems, which i called through an MSSQL query). i know this is supposed to be simple, yet i can't do it.
what am i doing wrong? do i need to change the report itself, or do i need to modify the VB6 code?
by the way, here's the exact code i used:
Private Sub Command1_Click()
Dim reportName As String, repSQL As String
reportName = "unionprofile.rpt"
repSQL = "Select Union_Profile.UnionID,Union_Profile.Name, Union_Profile.Acronym, Union_Profile.Address, Union_Profile.OrgDate, Member_Profile.MemberID, Member_Profile.LName, Member_Profile.FName from Union_Profile INNER JOIN Member_Profile ON Union_Profile.UnionID=Member_Profile.UnionID where Union_Profile.UnionID= '" & lblID.Caption & "';"
Load frmReportViewer
With frmReportViewer
Call .OpenRpt(reportName, repSQL)
.Show vbModal, frmUnions_Properties
End With
End Sub
Dim tmpRS2 as ADODB.Recordset, tmpSQL2 as String
Public Sub OpenRpt(ByVal rept As String, ByVal rSQL As String)
RSOpen tmpRS2, rSQL '---opens the recordset---
Set rpt = app1.OpenReport(App.Path & "\reports\" & rept, 1)
rpt.Database.SetDataSource tmpRS2, 3, 1
CRV.ReportSource = rpt
CRV.ViewReport
End Sub
please help.
1. i have a report created using CR8.5
2. in my VB6 project, i have a form which shows a particular item and its related subitems (lets call this frmProperties). i also have a CRViewer form (frmCRView).
3. my database is MS SQL Server 2000.
when i click a 'Preview' button on frmProperties, it loads frmCRView and shows the form i need. i used the code presented here (http://vbforums.com/showthread.php?t=380236&highlight=crystal+reports+tutorial).
however, i can't get the form to show the info i need. all i get is some random info from the database. what i need the form to show is the exact data in frmProperties (the particular item and its subitems, which i called through an MSSQL query). i know this is supposed to be simple, yet i can't do it.
what am i doing wrong? do i need to change the report itself, or do i need to modify the VB6 code?
by the way, here's the exact code i used:
Private Sub Command1_Click()
Dim reportName As String, repSQL As String
reportName = "unionprofile.rpt"
repSQL = "Select Union_Profile.UnionID,Union_Profile.Name, Union_Profile.Acronym, Union_Profile.Address, Union_Profile.OrgDate, Member_Profile.MemberID, Member_Profile.LName, Member_Profile.FName from Union_Profile INNER JOIN Member_Profile ON Union_Profile.UnionID=Member_Profile.UnionID where Union_Profile.UnionID= '" & lblID.Caption & "';"
Load frmReportViewer
With frmReportViewer
Call .OpenRpt(reportName, repSQL)
.Show vbModal, frmUnions_Properties
End With
End Sub
Dim tmpRS2 as ADODB.Recordset, tmpSQL2 as String
Public Sub OpenRpt(ByVal rept As String, ByVal rSQL As String)
RSOpen tmpRS2, rSQL '---opens the recordset---
Set rpt = app1.OpenReport(App.Path & "\reports\" & rept, 1)
rpt.Database.SetDataSource tmpRS2, 3, 1
CRV.ReportSource = rpt
CRV.ViewReport
End Sub
please help.