hi thanks for any help in advance.

i'm trying to add a record to a MS Access database(2003)

but i recieve this error: Syntax error in update statement

i don't know what's wrong with my code but i suspect that the problem lies in this bit of code.

If inc <> -1 Then

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

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

            'dsNewRow.Item("ID") = txtNumber.Text
            dsNewRow.Item("Name") = txtFullName.Text
            dsNewRow.Item("Address1") = txtAddress1.Text
            dsNewRow.Item("Address2") = txtAddress2.Text
            dsNewRow.Item("Address3") = txtAddress3.Text
            dsNewRow.Item("Phone") = txtPhone.Text
            datestr = txtDate.Text
            dsNewRow.Item("TheDate") = datestr
            dsNewRow.Item("Order") = txtOrder.Text

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

            da.Update(ds, "AddressBook")

            MsgBox("New Record added to the Database")

            btnCommit.Enabled = False
            btnAddNew.Enabled = True
            btnUpdate.Enabled = True
            btnDelete.Enabled = True

        End If
        da.Fill(ds, "AddressBook")
        MaxRows = ds.Tables("AddressBook").Rows.Count

>but i recieve this error: Syntax error in update statement

Maybe .mdb file is read-only or hasn't write permission.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.