+ Reply to Thread
Results 1 to 3 of 3

VBA/ADODB How to change/update value in access database

  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    57

    VBA/ADODB How to change/update value in access database

    Hello!

    I have a userform in excel that is linked to access database. Whenever I search for the employee/SAP ID# of staff, the userform retrieves all details and allows me to update them, except for the employee/SAP ID# itself. What I want is to have the option also to change the employee/SAP ID in the database.

    Thanks in advance for the help!

    Here's my code:

    In userform there are 6 textboxes. Textbox1 is what needs to be searched.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    01-15-2013
    Location
    Dubai, UAE
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: VBA/ADODB How to change/update value in access database

    Solved it!

    My error was I used the value in textbox6 as my search criteria and not the value in textbox1.

    Just fyi, my final code now is:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA/ADODB How to change/update value in access database

    I'd guess that's because SAP_ID is a Primary Key, you shouldn't ever change a primary key that's why primary keys are usually just incrementing numbers that don't actually hold any relevance to the data in the record.

    In your database, I suggest adding another field and making it the primary key and removing this from the SAP ID field

    Scrap the above, it appears it wasn't a PK after all

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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