Public Sub usingexe()
Dim cmd As ADODB.Command
Dim strSQL As String
Dim recs As Long
Set cmd = New ADODB.Command
strSQL = "UPDATE tblCompany SET CompanyName = 'G' WHERE CompanyName = 'A'"
Set cmd.ActiveConnection = CurrentProject.Connection
cmd.CommandText = strSQL
cmd.CommandType = adCmdText
cmd.Execute RecordsAffected:=recs, Options:=adExecuteNoRecords
Debug.Print recs & " Updated"
Set cmd = Nothing
End Sub
|