Update current record in Access using Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
Would someone be able to help me with the code to use to find a record in an
access table so I can update data for that record using information in an
excel spreadsheet.

Thanks
Noemi
 
Hi, the following piece of code will help you to update the name in a for a
given ID.

Const DSN As String = "ODBC;DATABASE=myDB;UID=;PWD=;DSN=DSN_TEST;"
Dim ws As DAO.Workspace
Dim con As DAO.Connection

Set ws = DAO.CreateWorkspace("", "", "", dbUseODBC)
Set con = ws.OpenConnection(DSN, dbDriverNoPrompt, False)
query = "UPDATE Map_Project_Resource SET NAME='madhan' WHERE ID='E001';"
con.Execute query
con.Close
ws.Close
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top