The Execute method will pass back the number of records operated on if you
use the correct parameter list.
Also, since Execute returns a Recordset, I can't follow why you are using
integer "I".
Given these variables:
Dim lngAffected as Long
Dim cnn as ADODB.Connectio n
Dim rst as ADODB.Recordset
Dim strSQL as String
You should use:
Set rst = cnn.Execute(str SQL, lngAffected, adExecuteNoReco rds)
In the above:
1) strSQL contains an action query, not a SELECT statement.
2) *lngAffected* returns how many records were inserted, updated, or deleted
3) adExecuteNoReco rds indicates that the sql is an action query and does not
return any records
You can use the shortcut syntax below since "rst" is returned as an Empty
and closed recordset.
Call cnn.Execute(str SQL, lngAffected, adExecuteNoReco rds)
Ian Hinson
"Steve" <st*********@fw uk.fwc.com> wrote in message
news:ad******** *************** ***@posting.goo gle.com...
Hi
I am having trouble with returning a value from an ado connection
execute function when using msaccess. If I execute a statement to
delete a record from a table I then have to loop through the table
until I can confirm that the record has in fact been deleted. This is
obviously affecting my applications performance.
What I need to do is something like :
Dim I as Integer
I = Adoconn.execute strsql
I need "I" to indicate whether or not the statement was successfull or
not.
I have also had cases where, if I try to return a recordset
immediately after an update statement, the recordset does not return
the updated value. If I cause a delay first then the correct info is
returned.
Anyway to sort these two things out?
Steve