Good afternoon,

I am a little lost here. Perhaps I am missing something. What I am trying to do is some test code were I have one user form, a text box and a button. I am trying to put the data in the textbox into an Access file by a click of the button. But nothing happens.


Code:
    Public Class Form1
    Dim MaxRows As Integer
    Dim inc As Integer
    Dim con As New OleDb.OleDbConnection
    Dim dbProvider As String
    Dim dbSource As String
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Dim sql As String

    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        If inc <> -1 Then

            Dim cb As New OleDb.OleDbCommandBuilder(da)
            Dim dsNewRow As DataRow

            dsNewRow = ds.Tables("NPS").NewRow()

            dsNewRow.Item("DOD") = TextBox1.Text


            ds.Tables("NPS").Rows.Add(dsNewRow)

            da.Update(ds, "NPS")

            MsgBox("New Record added to the Database")
        End If

        TextBox1.ResetText()


    End Sub

    Private Sub NewBRMAuto_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        TextBox1.ResetText()


        dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source = C:\Test\NPS.mdb"

        con.ConnectionString = dbProvider & dbSource

        con.Open()

        sql = "SELECT * FROM tblContacts"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "NPS")

        con.Close()

        MaxRows = ds.Tables("NPS").Rows.Count
        inc = -1

    End Sub
End Class