AddNew, Update and Delete

C

Chris Coghlan

I was wondering if you are able to use the AddNew Update and Delete commands
for a recordset using ODBC. My application keeps giving me a run-time
error. Cannot update. Database or object is read only. Below is a sample
of code I am using.

Set ws = CreateWorkspace("ASQL", "sa", "password", dbUseODBC)
Set db = ws.OpenDatabase("ASQL", , , "ODBC;DSN=ASQL")
Set rst = db.OpenRecordset("tbl_Company_Notes", dbOpenDynaset)
With rst
rst.AddNew
rst!Company_Id = Me.Company_Id
rst!EntryDate = Format(Date, "dd mmm yyyy")
rst!CompanyNotes = "Company was created in database by " & CurrentUser
& " on " & Format(Date, "dd mmm yyyy")
rst!UserName = CurrentUser
rst!Last_Update = Now()
rst.Update dbSeeChanges
End With
rst.Close
db.Close

Any help would be great.

Chris
 

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