Hello,
Currently I'm creating a data entry in VBA but now I'm stuck with the update button, the thing is I created a txtId in order to get the transaction ID (Primary Key auto increment) by using this code If Me.txtId.Value = Me.data_list.List(Me.data_list.ListIndex, 0) <> "" Then but it returns all the data in the textbox except for the transaction ID, instead of updating the data it add as a new transaction since there is no transaction ID in the txtId.Here's my full code below.
Private Sub btn_edit_Click()
If Me.data_list.ListIndex >= 0 Then
If Me.txtId.Value = Me.data_list.List(Me.data_list.ListIndex, 1) <> "" Then
Me.txt_receivedDate.Value = VBA.Format(Me.data_list.List(Me.data_list.ListIndex, 1), "D-MMM-YY")
Me.cb_Mailbox.Value = Me.data_list.List(Me.data_list.ListIndex, 2)
Me.tb_processor.Value = Me.data_list.List(Me.data_list.ListIndex, 3)
Me.TB_InsuredName.Value = Me.data_list.List(Me.data_list.ListIndex, 4)
Me.tb_requestID.Value = Me.data_list.List(Me.data_list.ListIndex, 5)
Me.tb_PolicyNumber.Value = Me.data_list.List(Me.data_list.ListIndex, 6)
Me.CB_Currency.Value = Me.data_list.List(Me.data_list.ListIndex, 7)
Me.tb_premium.Value = Me.data_list.List(Me.data_list.ListIndex, 8)
Me.tb_Transaction.Value = Me.data_list.List(Me.data_list.ListIndex, 9)
Me.tb_lob.Value = Me.data_list.List(Me.data_list.ListIndex, 10)
Me.cb_status.Value = Me.data_list.List(Me.data_list.ListIndex, 11)
Me.tb_DateHandled.Value = VBA.Format(Me.data_list.List(Me.data_list.ListIndex, 12), "D-MMM-YY")
Me.tb_remarks.Value = Me.data_list.List(Me.data_list.ListIndex, 13)
End If
Else
MsgBox "Please select a record to update", vbCritical
End If
End sub
errer.PNG
Bookmarks