Hi, Will a query like this on a recordset work
rs.open "select * from table where vd=1; update table set vd1 = 1 where vd=2 or vd=3;"
or is there anything wrong
thanks
Hi, Will a query like this on a recordset work
rs.open "select * from table where vd=1; update table set vd1 = 1 where vd=2 or vd=3;"
or is there anything wrong
thanks
It won't work - you'll have to execute them as separate commands
Presumably you've declared rs
as a recordset, so you can use that to return the SELECT
statement results.
I would use a SQL command to execute the second statement.
A recordset can only be defined with a single SELECT statement (though, of course, you can UNION multiple selects if they have the same number of columns).
Any action SQL (INSERT, UPDATE, DELETE) cannot be executed with a recordset, but by using the .Execute method.
If you're using ADO, .Execute can also be used for SELECTs (it returns the rows), but Jet's native data interface layer, DAO, cannot -- .Execute works only for action queries. This seems sensible to me, but then, ADO has always seemed like a waste of time to me, personally.
Also, Jet (the db engine used by default by Access) cannot execute multiple SQL statements at once as many server-based db engines can. This is not such a big limitation as it might seem to those accustomed to batching SQL statements -- it's just different.