Private Sub cmdguardar_Click()
If txtcodigo.Text = "" Then MsgBox "el campo usuario esta vacio", vbInformation, " AVISO ": txtcodigo.SetFocus: Exit Sub
If txtcosto.Text = "" Then MsgBox "el campo clave esta vacio", vbInformation, " AVISO ": txtcosto.SetFocus: Exit Sub
If txtventa.Text = "" Then MsgBox "el campo puesto esta vacio", vbInformation, " AVISO ": txtventa.SetFocus: Exit Sub
If txtproducto.Text = "" Then MsgBox "el campo puesto esta vacio", vbInformation, " AVISO ": txtproducto.SetFocus: Exit Sub
If txtuti.Text = "" Then MsgBox "el campo puesto esta vacio", vbInformation, " AVISO ": txtuti.SetFocus: Exit Sub
If txtcodigo.Text = "" Then MsgBox "el campo usuario esta vacio", vbInformation, " AVISO ": txtcodigo.SetFocus: Exit Sub
With Rsproductos
.Requery
.Find "CODIGOP='" & Trim(txtcodigo.Text) & "'"
If .BOF Or .EOF Then
.Requery
.AddNew
!codigop = txtcodigo.Text
!PRODUCTO = txtproducto
!costo = txtcosto.Text
!UTILIDAD = txtuti.Text
!subtotal = txtsubt.Text
!VENTA = txtventa.Text
!exento = 0
!GRAVADO = Val(txtcosto) * Val(txtimp) / 100
!IMPTOTAL = Val(txtcosto) * Val(txtimp)
.Requery
.Update
txtcosto = ""
txtimp = ""
txtuti = ""
txtsubt = ""
txtventa = ""
txtproducto = ""
cmblista = ""
txtcosto.SetFocus
Else
MsgBox " CODIGO YA EXITE", vbInformation, " CODIGO"
txtcodigo.SetFocus
txtcodigo.SelStart = 0
txtcodigo.SelLength = Len(txtcodigo.Text)
Exit Sub
End If
End With