Hi guys - whenever i run this code i get " SYNTAX ERROR (MISSING OPERATOR) IN QUERY EXPRESSION" - ive checked everywhere and cant find a solution

can anybody spot any errors here?

Try
            Dim updatecon As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;data source=H:\FROM HOME\EXTENDED PROJECT !!!!!!\Databases\Login Details.accdb")
            updatecon.Open()
            Dim updatecmd As OleDb.OleDbCommand = New OleDb.OleDbCommand("Update CustomerDetails SET Surname = '" & txtSurname.Text & "' AND Gender = '" & txtGender.Text & "' and FirstName = '" & txtForeName.Text & "' and Address1 = '" & txtAddress1.Text & "' and address2 = '" & txtAddress2.Text & "' and CarMake = '" & txtCarmake.Text & "' and CarModel = '" & txtModel.Text & "' and PostCode = '" & txtPostCode.Text & "' and HouseNumber = " & txtHouseNo.Text & " and ContactNumber1 = " & txtContactNo.Text & " and ContactNumber2 = " & txtContactNo2.Text & " and BorrowingAmmount = " & txtBorrowing.Text & " and YearlyIncome = " & txtYearly.Text & " and CreditRating = " & txtCredit.Text & " and Deposit = " & txtDeposit.Text & " and DOB = " & DateBirth.Text & " and Price = " & txtPrice.Text & " and Employed = " & chkEmployed.CheckState & " where Reference=" & txtReference.Text & " ", updatecon)

            updatecmd.ExecuteNonQuery()
            MsgBox("Record has been updated")
        Catch ex As OleDb.OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Oledb Error")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")

        End Try

Take a look at Update statement syntax.

Always use Parameters.

Dim updatecmd As OleDb.OleDbCommand = New OleDb.OleDbCommand("Update CustomerDetails SET Surname =@surname,Gender =@gender,FirstName = @firstname,Address1 = @address1, address2 = @address2 where Reference=@reference", updatecon)

updatecmd.Parameters.AddWithValue("@surname",txtSurname.Text)
....
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.