Execute - how many rows where updated?

  • Thread starter sfilzen via AccessMonster.com
  • Start date
S

sfilzen via AccessMonster.com

When an SQL statement is Executed, can the developer find out how many rows
were updated? As a former Oracle user I always used to get a system message
stating how many rows were inserted/updated and really miss that crucial
information.

Below is a code fragment from my Access 2000 program

Dim cmdCommand As ADODB.Command

strSQL = "UPDATE
where [Order Date] > #01/01/2000# "

Set cmdCommand.ActiveConnection = CurrentProject.Connection
cmdCommand.CommandText = strSQL
cmdCommand.Execute

Once the above fragment is run, I have no idea how many rows were updated.

Thanks for your help.
steve filzen
 
D

David Lloyd

Steve:

The first parameter of the Execute method allows you to specify a long
variable that will hold the value of the number of records affected by the
UPDATE statement. For example:

Dim cmdCommand As ADODB.Command
Dim lRecordsAffected as Long

strSQL = "UPDATE
where [Order Date] > #01/01/2000# "

Set cmdCommand.ActiveConnection = CurrentProject.Connection
cmdCommand.CommandText = strSQL
cmdCommand.Execute lRecordsAffected


--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


When an SQL statement is Executed, can the developer find out how many rows
were updated? As a former Oracle user I always used to get a system message
stating how many rows were inserted/updated and really miss that crucial
information.

Below is a code fragment from my Access 2000 program

Dim cmdCommand As ADODB.Command

strSQL = "UPDATE
where [Order Date] > #01/01/2000# "

Set cmdCommand.ActiveConnection = CurrentProject.Connection
cmdCommand.CommandText = strSQL
cmdCommand.Execute

Once the above fragment is run, I have no idea how many rows were updated.

Thanks for your help.
steve filzen
 

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