+ Reply to Thread
Results 1 to 1 of 1

Update records in ms access

  1. #1
    Registered User
    Join Date
    06-29-2022
    Location
    Manila, Philippines
    MS-Off Ver
    2022
    Posts
    3

    Update records in ms access

    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
    Last edited by ramonthepsycho; 06-29-2022 at 10:37 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Data type mismatch excel to update records in ms access
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2019, 10:44 AM
  2. Excel to update records in MS Access
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-28-2017, 05:29 AM
  3. Excel UserForm to browse, update, add and delete records in Access
    By takriv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2016, 11:15 AM
  4. [SOLVED] Update Access 2003 records using Excel 2003 via macro
    By kennethqiu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-04-2014, 05:58 PM
  5. Update records to Access 97 from Excel 97 via macro
    By kennethqiu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2014, 05:47 PM
  6. [SOLVED] Excel/Access update records
    By Raanan in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-19-2014, 05:14 AM
  7. [SOLVED] need to be able to update records with button click and delete records sample included
    By unreal11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2013, 11:45 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1