PROGRAMACION EN VISUAL BASIC
Publicado por manuel burgos (3 intervenciones) el 29/11/2011 08:11:04
POR FAVOR AYDENME TENGO ESTE CODIGO, Y E GENERA UN ERROR AL EJECUTAR... MI ENLACE ES CON ACCESS 2007...ERROR "424" ERROR DE EJECUCION SE REQUIERE UN OBJETO... SOLO QUIERO COMPARA QUE NO EXISTA DATOS DUPLICADOS
Private Sub cmdguardar_Click()
adozona.Refresh
With adozona.Recordset
adozona.Recordset.MoveFirst
Adousuario.Recordset.Find "codzona='" & Trim(txtcodzona.Text) & "'"
Adousuario.Recordset.Find "zona='" & Trim(txtzona.Text) & "'"
If adozona.Recordset.EOF = False Then
MsgBox "ya esta Registrado"
txtzona.Text = ""
cmdguardar.Enabled = False
Else
'adozona.Refresh
adozona.Recordset.AddNew
adozona.Recordset("codzona") = Trim(txtcodzona.Text)
adozona.Recordset("zona") = Trim(txtzona.Text)
adozona.Recordset.Update
MsgBox "Se Registró la Zona", vbOKOnly + vbExclamation, "Mensaje"
Call limpiar
cmdnuevo.Enabled = True
Call cargacodigo
cmdguardar.Enabled = False
End If
End With
End Sub
Private Sub cmdguardar_Click()
adozona.Refresh
With adozona.Recordset
adozona.Recordset.MoveFirst
Adousuario.Recordset.Find "codzona='" & Trim(txtcodzona.Text) & "'"
Adousuario.Recordset.Find "zona='" & Trim(txtzona.Text) & "'"
If adozona.Recordset.EOF = False Then
MsgBox "ya esta Registrado"
txtzona.Text = ""
cmdguardar.Enabled = False
Else
'adozona.Refresh
adozona.Recordset.AddNew
adozona.Recordset("codzona") = Trim(txtcodzona.Text)
adozona.Recordset("zona") = Trim(txtzona.Text)
adozona.Recordset.Update
MsgBox "Se Registró la Zona", vbOKOnly + vbExclamation, "Mensaje"
Call limpiar
cmdnuevo.Enabled = True
Call cargacodigo
cmdguardar.Enabled = False
End If
End With
End Sub
Valora esta pregunta


0