Re: Count number of records deleted

Tech-Archive recommends: Fix windows errors by optimizing your registry



Samantha wrote:

How can I count the number of records deleted using sql script?
Here is my code:

Dim strSQL As String
strSQL = "Delete * FROM [RMA DETAIL] "
strSQL = strSQL & " WHERE [DETAILID]=" & Me![lstDetail].Column(14)
CurrentDb().Execute strSQL

I tried this but it does not work:
MsgBox "count = " & strSQL.RecordCount


Dim db AS Database
Dim strSQL As String
strSQL = "Delete * FROM [RMA DETAIL] "
& " WHERE [DETAILID]=" & Me![lstDetail].Column(14)
Set db = CurrentDb()
db.Execute strSQL
MsgBox "count = " & db.RecordsAffected
Set db = Nothing

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: "INSERT INTO" doesnt work
    ... > database with the data. ... > Dim strSQL As String ... > Dim strVersion As String ... your post -- you never execute the SQL statement. ...
    (microsoft.public.access.formscoding)
  • Re: IN YOUR OPINION
    ... Dim strSql As String ... 'THE strSQL s the path to the new database that wil be written to... ... 'I check what the string is giving and it'sot giving the path, the path 'is in a field called BackPath in the tblBackPath, right now I just get 'the whole select statement. ... It's also saying that the IDNAME line is 'not in the current collection. ...
    (microsoft.public.access.formscoding)
  • RE: Proper simple Access VBA SQL syntax
    ... Function prepareForSqlServer(value As String) As String ... the following code works perfect so I know the quotes are ... Dim strSQL As String ... Dim strLeaseNumber As String ...
    (microsoft.public.access.modulesdaovba)
  • RE: Proper simple Access VBA SQL syntax
    ... Function prepareForSqlServer(value As String) As String ... the following code works perfect so I know the quotes are ... Dim strSQL As String ... Dim strLeaseNumber As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: inserting values from textboxes...
    ... I did find an example database that had ... Infael ... >Dim strSql As String ... >single quotes in the SQL string. ...
    (microsoft.public.access.formscoding)