How do I use SQL Server functions in a pass through query

  • Thread starter Thread starter GLI
  • Start date Start date
G

GLI

How do I get an update pass through query to return the
number of records it updated


Here is the query:


SET ARITHABORT ON

UPDATE tbl1 SET tbl1.field_1 = 111 , tbl1.field_2 = 100

FROM tbl1
LEFT JOIN tbl2 ON (tbl1.field_3 = tbl2.field_3)

WHERE tbl1.field_4 = 2004
AND tbl1.field_4 is not null
AND tbl2.field_4 = 'CA'
;

I have played with the SQL Server's @@ROWCOUNT function
but was
unable to get the value displayed on the screen.

I would like this to work with out the intervension of
VBA as
I need to use several of these quick little edits to
various tables in our SQL DB.

Access will return the updated record count if I link to
the tables but I want to
use a pass through query.

Thanks,
GLI
 
in dao
dim db as dao.database
db.execute <yoursql>
debug.print db.recordsaffected

hth

Pieter
 
Thank you for the help.
I was afraid that I would not be able to do this with out
using VBA.

Thanks Again,

GLI
 
Back
Top