Private Sub btoRegistro_Click()
'validar
If Me.Text1 = " " Then MsgBox "Debe ingresar datos", vbInformation, "aviso": Me.Text1 = " ": Me.Text1.SetFocus: Exit Sub
If Me.Text2 = " " Then MsgBox "Debe ingresar datos", vbInformation, "aviso": Me.Text2 = " ": Me.Text2.SetFocus: Exit Sub
If Me.Text3 = " " Then MsgBox "Debe ingresar datos", vbInformation, "aviso": Me.Text3 = " ": Me.Text3.SetFocus: Exit Sub
If Not IsNumeric(Me.Text3) Then MsgBox "Debe debe ser de tipo numerico el dato", vbInformation, "aviso": Me.Text3 = " ": Me.Text3.SetFocus: Exit Sub
'verificar si existe el producto
With regProducto
.Requery
.Find "id='" & Trim(Me.Text1) & "'"
'.Find "nomprep='" & Trim(Me.Text2) & "'"
If .EOF Then
.AddNew
!id = Me.Text1
!nombrep = Me.Text2
!preciop = CDbl(Me.Text3)
.Update
Set Form3.GRILLAPRODUCTO.DataSource = regProducto
MsgBox "Producto Guardado", vbInformation, "Aviso"
Unload Me
Else
MsgBox "El producto existe", vbInformation, "Aviso": Me.Text1 = " ": Me.Text1.SetFocu
End If
End With
End Sub
No hay comentarios:
Publicar un comentario