How to edit a SQL statement having Inner Join

M

Mota

Hello;
I have to Edit and Update a Table,accessed thru an Inner Join SQL (If it
helps,no matter inner join or left join or right join,for two tables are
joined by a one-to-one relationship havin referrential integrity for both
update and delete).My code is this:

Dim DB As Database, Rs As DAO.Recordset, StrSql As String
Set DB = DBEngine(0)(0)
StrSql = "select drugsTBL.*,OrdersTBL.* from drugsTBL inner join OrdersTBL "
StrSql = StrSql & "on DrugsTBL.DId=OrdersTBL.DId where DrugsTBL.Did=5"
Set Rs = DB.OpenRecordset(StrSql, 2)
With Rs
..Edit
!Order = "Take one Each 6 Hours"
..Update ' The line raises Error "Can not update.DB Object is ReadOnly"
End With
Rs.Close

For some reasons,i need to keep it as a Sql statement, and avoid from
converting it to a stored query.
Is there a trick to do such an Edit?
Thank you in advance.
 

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