Code:
Private Sub Sno_AfterUpdate() Dim dbs As DAO.Database Dim rs As DAO.Recordset Dim sql As String Dim tmp As Variant Dim bno As String bno = Me.BookNo.Value area = Me.area.Value Set dbs = CurrentDb 'sql = "select s_no from customer_info where [book_no]='bno';" Set rs = dbs.OpenRecordset("select s_no from customer_info where bookno='" & bno & "' and C_Area='" & area & "'") Do While rs.EOF = False If rs.Fields(0) = Me.S_No.Value Then Do While rs.EOF = False dbs.Execute ("update customer_info set s_no=" & rs.Fields(0) + 1 & " where C_Area='" & area & "'and bookno='" & bno & "' and s_no=" & rs.Fields(0)) rs.MoveNext Loop Else End If rs.MoveNext Loop If rs.EOF = False Then ElseIf rs.EOF = False Then End If
Comment