|
-
Oct 8th, 2007, 05:34 PM
#1
Thread Starter
Hyperactive Member
Having trouble loading recordset into crystal report.
Hello all,
I have created a crystal report (in crystal report 10), but cannot get the info from the form to load into it.
I am using code that I got on here from doing searches.
vb Code:
Case "Print"
Dim SQL As String
Dim oApp As New CRAXDDRT.Application
Dim oReport As New CRAXDDRT.Report
Set oReport = oApp.OpenReport(App.Path & "\ECI.rpt,1")
oReport.Database.Tables(1).Location = App.Path & "\ECI.mdb"
SQL = "SELECT tblECI.fldFDID,tblECI.fldDOB,tblECI.fldFname,tblECI.fldMI,tblECI.fldLname,tblECI.fldAddress," & _
" tblECI.fldCity,tblECI.fldState,tblECI.fldZip,tblECI.fldSname,tblECI.fldChildren1,tblECI.fldDob1,tblECI.fldChild2,tblECI.fld" & _
" tblECI.fldDob2,tblECI.fldChild3,tblECI.fldDob3,tblECI.fldChild4,tblECI.fldDob4,tblECI.fldChild5,tblECI.fldDob5," & _
" tblECI.fldChild6,tblECI.fldDob6,tblECI.fldChild7,tblECI.fldDob7,tblECI.fldContact1,tblECI.fldRelationship1," & _
" tblECI.fldAddress1,tblECI.fldPhone1,tblECI.fldCell1,tblECI.fldOther1,tblECI.fldContact2,tblECI.fldRelationship2," & _
" tblECI.fldAddress2,tblECI.fldPhone2,tblECI.fldCell2,tblECI.fldOther2,tblECI.fldContact3,tblECI.fldRelationship3," & _
" tblECI.fldAddress3,tblECI.fldPhone3,tblECI.fldCell3,tblECI.fldOther3,tblECI.fldPrimary,tblECI.fldFDID1,tblECI.fldSecondary," & _
" tblECI.fldFDID2,tblECI.fldReligious,tblECI.fldSrequest,tblECI.fldComments FROM " & _
" tblECI " & _
"WHERE tblECI.fldFDID = '" & txtFDID.Text & "'"
Set rs = DBconnection.Execute(SQL)
With oReport
.Database.SetDataSource rs, , 1
.PaperOrientation = 1
.PaperSize = 2
.EnableParameterPrompting = False
.DiscardSavedData
End With
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
I keep getting an error message that states:
" Variable not defined" and points to the crvMyCRViewer, but I'm not sure what to define the viewer as.
Any help would be greatly appreciated.
Now that I think of it; maybe I'm going about this the wrong way.
What I have is a form which the user does a search and this returns a recordset which loads into the form.
Then when the user clicks on the print button I want the information to load into the crystal report that I created.
Am I headed in the right direction?
Last edited by cfd33; Oct 8th, 2007 at 07:19 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|