Este es el codigo de ejemplo (Continuacion)
Private Sub cmdStatus_Click()
Dim iAfectados As Integer
If Not cmbStatus.Text = "" Then
SQL = ""
SQL = "select count(status_csi) as total from fax_xceltive where " & _
" status_CSI = " & cmbStatus.BoundText & _
" and remesa = " & frmRemesas.rsRemesas!REMESA & _
" and fecha_mov <= " & " '" & Trim(Format(dtpFecha_status.Value, "YYYY-MM-DD")) & " 23:59' "
rsTemp.Open SQL, cnx, adOpenStatic, adLockReadOnly
If rsTemp!TOTAL = 0 Then
MsgBox "No se encontraron registros con el criterio especificado", vbInformation, sTitulo_ventana
Else
If MsgBox("Se encontraron " & Str(rsTemp!TOTAL) & " registros con status " & cmbStatus.BoundText & _
". ¿Desea liberarlos?", vbYesNo + vbInformation, "Liberación de registros") = vbYes Then
SQL = ""
SQL = "UPDATE xceltive set Agente = NULL, status_csi = 0, intentos = 0 where status_CSI = " & _
cmbStatus.BoundText & " and remesa = " & frmRemesas.rsRemesas!REMESA
cnx.Execute SQL, iAfectados
MsgBox "Se liberaron " & Str(iAfectados) & " registros", vbInformation, sTitulo_ventana
Else
MsgBox "Proceso cancelado por el usuario", vbInformation, sTitulo_ventana
End If
End If
rsTemp.Close
Else
MsgBox "Debe elegir un status de la lista para ejecutar el proceso", vbCritical, sTitulo_ventana
End If
End Sub