Open Recordset for editing

G

Gibson

I am using the following code to open an external database and add a record
to a table.
strTableName = "flkpTable1"
strDBName = "C:\Program Files\Database.MDB"
Set dbImp = DBEngine.Workspaces(0).OpenDatabase(strDBName, False, True,
"")
Set rsImp = dbImp.OpenRecordset(strTableName, dbOpenDynaset)
rsImp.FindFirst "Field1 = '" & Variable1 & "'"
If rsImp.NoMatch Then
rsImp.AddNew

The code works fine until I get to the AddNew portion. I get an error
message telling me Cannot update, Database or Object is Read-Only. I don't
believe the database is read only. Is it possible to update the database?
Maybe there is something wrong with my code?

Thanks
 

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

Top