HI guys
i have getting a problem about my userform for updating records . i have 16 TEXTBOX in my USERFORM and to get the the data i use search button in my userform.
well the problem is when after i search the data and update it when i click the update button the data that i updated was appear in the first row and replace the data that was in there .
wish someone can help me her.
here are my code for update button
answer = MsgBox("Are you sure you want to update the record?", vbYesNo + vbQuestion, "Update Record")
If answer = vbYes Then
Cells(currentrow, 1) = TextBox1.Text
Cells(currentrow, 2) = TextBox2.Text
Cells(currentrow, 3) = TextBox3.Text
Cells(currentrow, 4) = TextBox4.Text
Cells(currentrow, 5) = TextBox5.Text
Cells(currentrow, 6) = TextBox6.Text
Cells(currentrow, 7) = TextBox7.Text
Cells(currentrow, 8) = TextBox8.Text
Cells(currentrow, 9) = TextBox9.Text
Cells(currentrow, 10) = TextBox10.Text
Cells(currentrow, 11) = TextBox11.Text
Cells(currentrow, 12) = TextBox12.Text
Cells(currentrow, 13) = TextBox13.Text
Cells(currentrow, 14) = TextBox14.Text
Cells(currentrow, 15) = TextBox15.Text
Cells(currentrow, 16) = TextBox16.Text
End If
listDisplay1.ColumnCount = 16
listDisplay1.RowSource = "A1:J65356"
End Sub
i have getting a problem about my userform for updating records . i have 16 TEXTBOX in my USERFORM and to get the the data i use search button in my userform.
well the problem is when after i search the data and update it when i click the update button the data that i updated was appear in the first row and replace the data that was in there .
wish someone can help me her.
here are my code for update button
answer = MsgBox("Are you sure you want to update the record?", vbYesNo + vbQuestion, "Update Record")
If answer = vbYes Then
Cells(currentrow, 1) = TextBox1.Text
Cells(currentrow, 2) = TextBox2.Text
Cells(currentrow, 3) = TextBox3.Text
Cells(currentrow, 4) = TextBox4.Text
Cells(currentrow, 5) = TextBox5.Text
Cells(currentrow, 6) = TextBox6.Text
Cells(currentrow, 7) = TextBox7.Text
Cells(currentrow, 8) = TextBox8.Text
Cells(currentrow, 9) = TextBox9.Text
Cells(currentrow, 10) = TextBox10.Text
Cells(currentrow, 11) = TextBox11.Text
Cells(currentrow, 12) = TextBox12.Text
Cells(currentrow, 13) = TextBox13.Text
Cells(currentrow, 14) = TextBox14.Text
Cells(currentrow, 15) = TextBox15.Text
Cells(currentrow, 16) = TextBox16.Text
End If
listDisplay1.ColumnCount = 16
listDisplay1.RowSource = "A1:J65356"
End Sub