Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/07/2005, 10:27
Avatar de lucasiramos
lucasiramos
 
Fecha de Ingreso: agosto-2004
Ubicación: Santa Rosa, La Pampa, Argentina
Mensajes: 1.484
Antigüedad: 19 años, 9 meses
Puntos: 13
Aquí te paso un ejemplo que tengo de transacciones. Tendrías que adaptarlo a tus necesidades:

Código:
	Dim Tipo As String
	
	If optDebito.Value = True Then
		Tipo = "D"
	Else
		Tipo = "C"
	End If
	
	   
	CN.BeginTrans
	CmGrabar.ActiveConnection = CN
	CmGrabar.CommandType = adCmdText
		
	If cmdGrabar.Caption = "&Grabar" Then
		CmGrabar.CommandText = "INSERT INTO Detalle (id,idmaestro,tipomov,codmov,fechamov,descripcion,saldo) VALUES (" & txtId.Text & ", " & cboClientes.ItemData(cboClientes.ListIndex) & ", '" & Tipo & "', '" & txtCodmov.Text & "', '" & Now & "', '" & txtDescripcion.Text & "', " & Replace(txtSaldo.Text, ",", ".") & ")"
	Else
		CmGrabar.CommandText = "UPDATE Detalle SET tipomov = '" & Tipo & "', codmov = '" & Trim(txtCodmov.Text) & "', fechamov = '" & Trim(txtFechamov.Text) & "', descripcion = '" & Trim(txtDescripcion.Text) & "', saldo = " & Replace(txtSaldo.Text, ",", ".")
	End If
	CmGrabar.Execute 'Graba físicamente los registros
	If MsgBox("¿Confirma datos?", vbYesNo) = vbNo Then
		CN.RollbackTrans 'Vuelve atras con los cambios
	Else
		CN.CommitTrans 'Permite la transacción
		If cmdGrabar.Caption = "&Grabar" Then
			MsgBox "Movimiento agregado"
		Else
			MsgBox "Movimiento modificado"
		End If
	End If
Espero que te sirva.
Saludos. Lucas