Visual Basic - Agregar datos a una base de datos desde un formulario

Life is soft - evento anual de software empresarial
 
Vista:
sin imagen de perfil

Agregar datos a una base de datos desde un formulario

Publicado por Agos (3 intervenciones) el 17/03/2016 05:32:31
Hola a todos! espero q puedan ayudarme.

Tengo un formulario donde ingreso un socio nuevo pero a la hora de guardarlo siempre me lo copia en el mismo lugar en la base de datos. Aca les paso el codigo, no veo donde puede llegar a estar el error

Gracias de antemano

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Private Sub CmdSiguiente_Click()
 
 
If TxtDNI.Text <> "" And TxtNombre.Text <> "" And TxtApellido.Text <> "" And TxtDomicilio.Text <> "" And TxtLocalidad.Text <> "" And TxtFechaIngreso.Text <> "" Then
 If Len(TxtFechaIngreso.Text) = 10 And Len(TxtDNI.Text) = 10 Then
  Else
   MsgBox " La fecha de Ingreso y/o el número de DNI no son correctos", vbOKOnly, ""
   Exit Sub
  End If
 Else
    MsgBox "Complete todos los datos del formulario", vbOKOnly, "Completar Datos"
    Exit Sub
 End If
    If base.RecordCount = 0 Then
        Set base = Nothing
        base.Open "SELECT * From SOCIOS", a, adOpenDynamic, adLockOptimistic
      If base.BOF And base.EOF Then
       base.AddNew
    ElseIf base.RecordCount > 0 Then
            base.MoveLast
            base.AddNew
      End If
    End If
 
base!NOMBRE_SOCIO = TxtNombre.Text
base!APELLIDO_SOCIO = TxtApellido.Text
base!LOCALIDAD_SOCIO = TxtLocalidad.Text
base!DOMICILIO_SOCIO = TxtDomicilio.Text
base!DNI_SOCIO = TxtDNI.Text
base!FECHA_INGRESO = TxtFechaIngreso.Text
 
base.Update
 
CmdCancelar.Enabled = False
 
Set base = Nothing
Set a = Nothing
Contratos.Show 0
Me.Hide
 
End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder