Ver Mensaje Individual
  #14 (permalink)  
Antiguo 13/04/2011, 12:18
Avatar de lokoman
lokoman
 
Fecha de Ingreso: septiembre-2009
Mensajes: 502
Antigüedad: 14 años, 7 meses
Puntos: 47
Respuesta: No ingresar daros repetidos acces desde VB

Acabo de verificar tu proyecto, aquí está la rutina funcionando:

Código vb:
Ver original
  1. Private Sub Ingreso_a_Lista_Click()
  2.     Dim strVALOR_ESPECIALIDAD As String
  3.     Dim strVALOR_DOCUMENTO As String
  4.     Dim rsConsulta As ADODB.Recordset
  5.     Set rsConsulta = New ADODB.Recordset
  6.  
  7.     strVALOR_ESPECIALIDAD = DataCombo1.Text
  8.     strVALOR_DOCUMENTO = Text1.Text
  9.    
  10.     If rst.EOF = False And rst.BOF = False Then
  11.     rsConsulta.Open "SELECT * FROM ListadeEspera WHERE Especialidad = '" & strVALOR_ESPECIALIDAD & "' and Documento = " & strVALOR_DOCUMENTO, cnn, adOpenDynamic, adLockBatchOptimistic
  12.        
  13.         If rsConsulta.EOF = False Then
  14.             MsgBox "No Se puede Ingresar Dos veces en la misma Lista de Espera a un mismo Usuario"
  15.             rsConsulta.Close
  16.             Set rsConsulta = Nothing
  17.             Exit Sub
  18.         Else
  19.             cnn.Execute "INSERT INTO ListadeEspera (FechaIngreso,Documento,Especialidad,Medico,Nombre1,Nombre2,Apellido1,Apellido2,Carne,Vencimiento,Telefonos,Observaciones) Values('" & _
  20.                         LabelFechaIngresoLE.Caption & "','" & Text1.Text & "','" & DataCombo1.Text & "','" & DataCombo2.Text & "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & " ','" & Text9.Text & " ')"
  21.             MsgBox "El Usuario ha sido Agregado a la base de datos de manera exitosa!"
  22.         End If
  23.     End If
  24. End Sub


Nos cuentas!!