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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report

Status
Not open for further replies.

jnavarro

Programmer
Dec 1, 2003
89
US
Does anyone know how to create a crystal report using an existing dataset? The dataset is currently been filled with an access db. I am trying to use the dataset to fill the information that I want to display. Everytime I call the routine I received an error "object reference not set to an instance of an object".

Here is my code.
Dim frmViewer As New frmReportViewer
With frmViewer
Dim MyMDIParent = Me.MdiParent.FindForm
.StartPosition = formStartPosition.CenterScreen
.TopMost = True
.MdiParent = MyMDIParent
.WindowState = FormWindowState.Normal

Dim rptEmployee As New rptEmployeeInfo
rptEmployee.SetDataSoure = dsEmployee1
.crvReport.ReportSource = rptEmployee
.crvReport.Zoom(2)
.Show()
End With


Thanks in advance
 
Which line of code throws the error?


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Both the setdatasource and report source

rptEmployee.SetDataSoure = dsEmployee1
.crvReport.ReportSource = rptEmployee

 
Well, the only 2 candidates for the cause of the error are rptEmployee and dsEmployee1. Since you Dim rptEmployee As New rptEmployeeInfo, this is not the problem, which leaves dsEmployee1 as the culprit.

Where do you declare this dataset? Is it visible to the code you posted?


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
the dataset is used to display information on a user form.
I am able to preview the information and everything looks ok.

Can you provide the way you should declare a crystal report with a ms access dataset?

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top