+ Reply to Thread
Results 1 to 3 of 3

Update/Delete a Record in an Access 2010 Database using Excel VBA

  1. #1
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2010
    Posts
    117

    Update/Delete a Record in an Access 2010 Database using Excel VBA

    Hi, I am hoping someone can help me get the right code to update a record in Access 2010. I have this code which works great for creating a new Record. However I would also like to Edit and Delete records but my efforts have so far failed and my brain is becoming gloopy. My Access Table has a Column for "Recordset_ID" so this would be the unique identifier for the record.

    I've tried incorporate a statement like UPDATE Analyst_Data SET Analyst_Name='Tom Lancaster' WHERE Recordset_ID=1 but this returned an error about a missing parameter value.

    The code I am using to add a record is below - any help on adjusting this to update and delete a record will be very much appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2010
    Posts
    117

    Re: Update/Delete a Record in an Access 2010 Database using Excel VBA

    My brain started functioning again after a cup of tea and I managed to get it to work using this code:

    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: Update/Delete a Record in an Access 2010 Database using Excel VBA

    Glad you got it sorted as an aside, it's generally not a good idea to auto-instance classes e.g

    Please Login or Register  to view this content.
    Should really be:

    Please Login or Register  to view this content.
    You're unlikely to get into any issues in the short term, but it's a good habit to get into and solves problems with more complex code. If you're interested Chip Pearson discusses it on his site.

+ 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