UPDATE |
Private Sub CommandButton1_Click() Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim com, tip As String Dim name, author, genre, izd, year, t As String If cn Is Nothing Then Set cn = New ADODB.Connection cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\\Desktop\27.05\_1.accdb" cn.Open End If If rs Is Nothing Then Set rs = New ADODB.Recordset End If If rs.State = 1 Then rs.Close End If com = "SELECT * FROM WHERE " name = rs.Fields(1).Value author = rs.Fields(2).Value genre = rs.Fields(3).Value izd = rs.Fields(4).Value year = rs.Fields(5).Value t = rs.Fields(6).Value If (TextBox1.text = name And TextBox2.text = author And ComboBox1.text = genre And TextBox4.text = izd And TextBox5.text = year And ComboBox2.text = t) Then com = "UPDATE SET = + 1" Else com = "INSERT INTO (,,,,,)VALUES ('" & TextBox1.text & "', '" & TextBox2.text & "', '" & ComboBox1.text & "', '" & TextBox4.text & "', '" & TextBox5.text & "', '" & ComboBox2.text & "');" rs.Open com, cn TextBox1.text = "" TextBox2.text = "" ComboBox1.text = "" TextBox4.text = "" TextBox5.text = "" ComboBox2.text = "" End If End Sub
http://www.sql.ru/forum/1294893/izmenenie-dannyh-v-tablice-s-pomoshhu-update