• Jueves 28 de Marzo de 2024, 20:38

Autor Tema:  Validar Informacion Y Adiconar  (Leído 738 veces)

fomd

  • Nuevo Miembro
  • *
  • Mensajes: 1
    • Ver Perfil
Validar Informacion Y Adiconar
« en: Jueves 4 de Diciembre de 2003, 15:14 »
0
tengo un gran problema esta haciendo un programa y nesecito adicionar la informacion pero validando primero el nit y el nombre de la empresa si ya estan que no haga nada pero si no estan que los adicione.
hasta el momento el me busca si estan y aparece el mensaje pero si no esta tambien me aparece el mensaje.

es urgente

gracias

el codigo esta debajo.

Public Sub AdicionarRegistro()
coincidencia% = 0
'If txtnit.Text <> "" And txtnombre.Text <> "" Then
   
    If txtcorreoa.Text = "" Then txtcorreoa.Text = "x"
    If txtdireccion.Text = "" Then txtdireccion.Text = "x"
    If txttelefono.Text = "" Then txttelefono.Text = "x"
   

If Data1.Recordset.RecordCount >= 1 Then
     marca = Data1.Recordset.Bookmark
End If

  With Data1
    .RecordSource = "Select * From Empresa Where (Nit ='" & txtnit.Text & "') Or (Nombre_Empresa = '" & txtnombre.Text & "')"
    .Refresh 'determina si la cédula ingresada ya la posee otro funcionario
    coincidencia% = .Recordset.RecordCount
  End With
 
  If coincidencia% >= 1 Then 'ya existe un registro con el mismo login, password o cédula
      MsgBox "La Cédula, El login o Password ingresado ya lo posee otro usuario,por favor verifique ", vbInformation + vbOKOnly, "Dian"
      Exit Sub
  Else
    Data1.Recordset.AddNew
    MsgBox "ya estubo"
  End If
  Exit Sub
 End Sub
Public Sub AdicionarRegistro()

coincidencia% = 0
'If txtnit.Text <> "" And txtnombre.Text <> "" Then
   
    If txtcorreoa.Text = "" Then txtcorreoa.Text = "x"
    If txtdireccion.Text = "" Then txtdireccion.Text = "x"
    If txttelefono.Text = "" Then txttelefono.Text = "x"
   

If Data1.Recordset.RecordCount >= 1 Then
     marca = Data1.Recordset.Bookmark
End If

  With Data1
    .RecordSource = "Select * From Empresa Where (Nit ='" & txtnit.Text & "') Or (Nombre_Empresa = '" & txtnombre.Text & "')"
    .Refresh 'determina si la cédula ingresada ya la posee otro funcionario
    coincidencia% = .Recordset.RecordCount
  End With
 
  If coincidencia% >= 1 Then 'ya existe un registro con el mismo login, password o cédula
      MsgBox "La Cédula, El login o Password ingresado ya lo posee otro usuario,por favor verifique ", vbInformation + vbOKOnly, "Dian"
      Exit Sub
  Else
    Data1.Recordset.AddNew
    MsgBox "ya estubo"
  End If
  Exit Sub
 End Sub
Public Sub AdicionarRegistro()
coincidencia% = 0
'If txtnit.Text <> "" And txtnombre.Text <> "" Then
   
    If txtcorreoa.Text = "" Then txtcorreoa.Text = "x"
    If txtdireccion.Text = "" Then txtdireccion.Text = "x"
    If txttelefono.Text = "" Then txttelefono.Text = "x"
   

If Data1.Recordset.RecordCount >= 1 Then
     marca = Data1.Recordset.Bookmark
End If

  With Data1
    .RecordSource = "Select * From Empresa Where (Nit ='" & txtnit.Text & "') Or (Nombre_Empresa = '" & txtnombre.Text & "')"
    .Refresh 'determina si la cédula ingresada ya la posee otro funcionario
    coincidencia% = .Recordset.RecordCount
  End With
 
  If coincidencia% >= 1 Then 'ya existe un registro con el mismo login, password o cédula
      MsgBox "La Cédula, El login o Password ingresado ya lo posee otro usuario,por favor verifique ", vbInformation + vbOKOnly, "Dian"
      Exit Sub
  Else
    Data1.Recordset.AddNew
    MsgBox "ya estubo"
  End If
  Exit Sub
 End Sub