PDA

Click to See Complete Forum and Search --> : Need help having data without the command... crystal report 9


edgarbenilde
Oct 18th, 2007, 03:25 AM
hi, here is my problem...

upon loading my crystal report there is default load data is already display in the
screen even if i didn't assign it yet....

i'm using excel database and i like it to the access then i made querry there and that is what i'm using for this report... called "RSOquerryFinal"

UsePrintRSONO_rpt can have the value upon clicking the print button by getting the RSONO

now, it's should be print the RSONO number that has in my RSO textbox but it is not printing the selected RSONO number instead of having the default data which the first RSONO number in the database...

why is like that? help me please i can't find the where is locking here..

help please..?

now, here is my code
=====================================================


private sub form_load

Dim newRep As New CrystalReportFillBy
OpenConnection()
GetRecords(UsePrintRSONO_rpt)
newRep.SetDataSource(ds)
newRep.Refresh()
CrystalReportViewer1.RefreshReport()
getRsoNoToBePrint()


end sub



Private Sub openconnection()
If cn.State = ConnectionState.Closed Then
cn = New OleDbConnection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\ph-suman\rso\Rsodb.mdb;User Id=admin;Password=;"
cn.Open()
End If
End Sub



Private Sub GetRecords(ByVal UsePrinRSONO As String)

Try

ds = New DataSet
Dim cmd As New OleDbCommand
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * from RSOQuerryFinal where RsoNo='" & UsePrinRSONO & "'"
da = New OleDbDataAdapter
da.SelectCommand = cmd
da.Fill(ds, "RSOQuerryFinal")


Catch ex As Exception
MsgBox(ex.ToString)
MsgBox(ex.Message)
End Try

edgarbenilde
Oct 18th, 2007, 03:33 AM
and how could i prevent in openning new form report..?

because everytime i press the print button it always open new form report instead refreshing the form....

how could i make it..?

edgarbenilde
Oct 18th, 2007, 04:38 AM
why i got error here

object not reference for an instance...


GetRecords(UsePrintRSONO_rpt)
crystalReport.SetDataSource(ds)
crystalReport.Refresh()
CrystalReportViewer1.ReportSource = crystalReport]


cam anyone help..?

nick2k3
Oct 23rd, 2007, 10:40 AM
why i got error here

object not reference for an instance...


GetRecords(UsePrintRSONO_rpt)
crystalReport.SetDataSource(ds)
crystalReport.Refresh()
CrystalReportViewer1.ReportSource = crystalReport]


cam anyone help..?

hey you forgot to initialize your dataset (ds)