VALIDAR REGISTROS
Publicado por jomar (1 intervención) el 14/11/2009 17:24:51
SOY NUEVO EN LA PROGRAMACION QUE ME AYUDEN PORFAVOR
VALIDAR CEDULA QUE NO SE DUPLIQUE
GRACIAS DE ANTEMANO
Private Sub cmdGuardar_Click()
On Error GoTo ErrorSub
'Agrega el registro
'''''''''''''''''''''''''''''''
Select Case ACCION
Case editar_registro
cnn.Execute "UPDATE Clientes set Cedula = '" & Text1(0) & _
"', Nombre = '" & Text1(1) & _
"', Direccion = '" & Text1(2) & _
"', Telefono = '" & Text1(3) & _
"' where Cedula = " & IdRegistro & ""
Case agregar_registro
cnn.Execute "INSERT INTO Clientes "&"(Cedula,Nombre,Direccion,Telefono,FechaDeAlta) VALUES('" & _
Text1(0) & "','" & _
Text1(1) & "','" & _
Text1(2) & "','" & _
Text1(3) & "','" & _
Format(Date, "dd/mm/yyyy") & "')"
End Select
rs.Requery 1
DoEvents
Unload Me
Set frmNvo = Nothing
Exit Sub
ErrorSub:
MsgBox Err.Description
End Sub
VALIDAR CEDULA QUE NO SE DUPLIQUE
GRACIAS DE ANTEMANO
Private Sub cmdGuardar_Click()
On Error GoTo ErrorSub
'Agrega el registro
'''''''''''''''''''''''''''''''
Select Case ACCION
Case editar_registro
cnn.Execute "UPDATE Clientes set Cedula = '" & Text1(0) & _
"', Nombre = '" & Text1(1) & _
"', Direccion = '" & Text1(2) & _
"', Telefono = '" & Text1(3) & _
"' where Cedula = " & IdRegistro & ""
Case agregar_registro
cnn.Execute "INSERT INTO Clientes "&"(Cedula,Nombre,Direccion,Telefono,FechaDeAlta) VALUES('" & _
Text1(0) & "','" & _
Text1(1) & "','" & _
Text1(2) & "','" & _
Text1(3) & "','" & _
Format(Date, "dd/mm/yyyy") & "')"
End Select
rs.Requery 1
DoEvents
Unload Me
Set frmNvo = Nothing
Exit Sub
ErrorSub:
MsgBox Err.Description
End Sub
Valora esta pregunta


0