I have some problem with my report. I don't know how to update my report. Every time i enter any data, the report did not show the added data.

Please guys i need help. Thank you in advance, God bless.

Report , what report ?
Where you enter data ?
Is that connected to database ?
What database ?
How the report gets populated ?

?
??
???

What report? Crystal Report sir.
Where you enter data, is it connected to database? I enter my data at my registration form, and yes it is connected to database, i'm using database 2010.

My only problem is, i don't know how to update the report to the newest data.

Is your data getting updated into the DB before yo invoke the report ?

Do you refresh the recordset once the data is updaetd in the DB ?

and finally what is database 2010 ? Is it MS Access 2010 ?

Edited 5 Years Ago by debasisdas: n/a

Is your data getting updated into the DB before yo invoke the report ?
-Yes.

Do you refresh the recordset once the data is updaetd in the DB ?
-Yes, but the report is still the same, it didn't display the updated record set.

and finally what is database 2010 ? Is it MS Access 2010 ?
-Yes.

Hi Jake!
First create Table into your Database that will be used for temporary data storage
let's say the Table called Reports. Note that Your report have to peek records from
this Table(Reports)

Secondly you have to clear your DataTable(repTable), then deleting records from your temporary Table(Reports) of your Data base as like this

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        repTable.Rows.Clear()
        cmd = New OleDbCommand("DELETE FROM Reports WHERE ID=" & 1 & "", con)
        cmd.ExecuteNonQuery()

After this codes you have to add the new records into your Temporery Table like this

Try

rRow = repTable.NewRow
        rRow("ID") = 1
        rRow("TDate") = LbDate.Text
        rRow("M_Saving") = LbSaving.Text
        rRow("M_Interest") = LbInterest.Text
        rRow("M_Receipts") = LbReceipts.Text
        repTable.Rows.Add(rRow)
        report_da.Update(repTable)

 Catch ex As Exception

 End Try

Try this I think it will work for you. Any Difficulties feel free to write to me through hilal2day@yahoo.com

@Hilal

It didn't work sir. see if my code is correct. i'll post my code here.

Private Sub UpdateBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UpdateBtn.Click
        Dim repTable As New DataTable
        Dim rRow As DataRow
        Dim report_da As New OleDbDataAdapter
        Dim con As New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=C:\Project\MuscleWorxGym1.mdb")
        repTable.Rows.Clear()
        Dim cmd As OleDbCommand = New OleDbCommand("DELETE FROM Report WHERE ID=" & 1 & "", con)
        cmd.ExecuteNonQuery()

        Try

            rRow = repTable.NewRow
            rRow("ID") = 1
            rRow("LastName") = SignUp.LastNameTF.Text
            rRow("FirstName") = SignUp.FirstNameTF.Text
            rRow("BirthdayField") = SignUp.dayBox.Text & SignUp.yearBox.Text & SignUp.monthBox.Text
            rRow("WeightField") = SignUp.numWeight.Text & " " & SignUp.kgbutton.Text & ", " & SignUp.weightNum.Text & " " & SignUp.weightType.Text
            rRow("HeightField") = SignUp.numHeight.Text & " " & SignUp.cmbutton.Text & ", " & SignUp.HeightNum.Text & " " & SignUp.HeightType.Text
            repTable.Rows.Add(rRow)

            report_da.Update(repTable)

        Catch ex As Exception

        End Try
    End Sub
End Class

@Jake
First I want to know if the records sent into your database by using this block of codes. May be let's me tell you how this block of codes work

1.Each time when you add new records, first it clears the data table and delete any previous records from your report Table of your Database
2.It adds new records into your report table, this is just like replacement of previous records with the new one.

So after doing this use this report Table as the data source for for your report.

Also don't specify the direct path to the database, allow the program to find the directory path itself like this

Dim con As New OleDbConnection
    Dim dSource As String
    Dim dProvider As String
dProvider = "Provider=Microsoft.Jet.OLEDB.4.0;"
        dSource = "Data Source=|DataDirectory|\MuscleWorxGym1.mdb"
        con.ConnectionString = dProvider & dSource
        con.Open()

Try this this again my friend and give me the feed back.

Edited 5 Years Ago by Hilal2009: n/a

Thank you hilal2009, I've done it, thank you so much sir.

This question has already been answered. Start a new discussion instead.