General discussion

Locked

Edit an Access Database from Excel using DAO

By ninedemo ·
Can anyone help me edit the following code so that I can use an excel row to edit an access database. The code is to be put in a Macro and used via command button on excel worksheet.
Dim dbMyDB As Database
Set dbMyDB = OpenDatabase("C:\Pro.mdb")
Dim rsMyRS As Recordset
Set rsMyRS = dbMyDB.OpenRecordset("Customers", dbOpenDynaset)

rsMyRS.Edit
rsMyRS!Name = Range(10, 1)' here is the prob
rsMyRS.Update

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by bschaettle In reply to Edit an Access Database f ...

The code you posted is trying to put a range of cells into the "Name" field of the current record. It should look more like this:

rsMyRS!Name = Range("A1").Value

Collapse -

by ninedemo In reply to Edit an Access Database f ...

When I changed the code as per answer below the results where interesting. However only the first record of the Feild in database was edited. How can I modify the code to edit a whole Feild in an access table. Remember that this is supposed to be a macro placed in excel!

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums