
Funcion if dejo de funcionar
Publicado por Luis (32 intervenciones) el 27/10/2022 01:57:58
Tengo un formulario que funcionaba perfectamente, si dejaba un texto en blanco me daba un mensaje, ahora no me funciona, este es el código:
Private Sub cmbProcesar_Click()
If Me.txtbultos_in.Value = Null Or Me.txtbultos_in.Value = "" Then
MsgBox "DEBE COLOCAR EL NUMERO DE BULTOS", vbCritical, "AVISO"
Me.txtbultos_in.SetFocus
Else
If Me.txtunidades_in.Value = Null Or Me.txtunidades_in.Value = "" Then
MsgBox "DEBE COLOCAR EL NUMERO DE UNIDADES", vbCritical, "AVISO"
Me.txtunidades_in.SetFocus
Else
Set Rs = CurrentDb.OpenRecordset("SELECT * FROM T_Stock WHERE Codigo= '" & [Forms]![frm_lista_productos]![txtcodigo] & "'", dbOpenDynaset)
With Rs
.Edit
!Cantidad_Bultos = !Cantidad_Bultos - Me.txtbultos_in.Value
!Cantidad_Unidades = !Cantidad_Unidades - Me.txtunidades_in
Me.txtcantidad_bultos = Rs!Cantidad_Bultos
Me.txtcantidad_unidades = Rs!Cantidad_Unidades
Forms!frm_lista_productos.txtbultos.Requery
Forms!frm_lista_productos.txtunidades.Requery
Forms!frm_stock_detalle.txtbultos = Rs!Cantidad_Bultos
Forms!frm_stock_detalle.txtunidades = Rs!Cantidad_Unidades
.Update
End With
Rs.Close
Set Rs = Nothing
MsgBox "EL STOCK DE MODIFICO CORRECTAMENTE", vbInformation, "AVISO"
Me.txtbultos_in.Value = ""
Me.txtbultos_in.Value = Null
Me.txtunidades_in.Value = ""
Me.txtunidades_in.Value = Null
Me.txtbultos_in.SetFocus
End If
End If
End Sub
Private Sub cmbProcesar_Click()
If Me.txtbultos_in.Value = Null Or Me.txtbultos_in.Value = "" Then
MsgBox "DEBE COLOCAR EL NUMERO DE BULTOS", vbCritical, "AVISO"
Me.txtbultos_in.SetFocus
Else
If Me.txtunidades_in.Value = Null Or Me.txtunidades_in.Value = "" Then
MsgBox "DEBE COLOCAR EL NUMERO DE UNIDADES", vbCritical, "AVISO"
Me.txtunidades_in.SetFocus
Else
Set Rs = CurrentDb.OpenRecordset("SELECT * FROM T_Stock WHERE Codigo= '" & [Forms]![frm_lista_productos]![txtcodigo] & "'", dbOpenDynaset)
With Rs
.Edit
!Cantidad_Bultos = !Cantidad_Bultos - Me.txtbultos_in.Value
!Cantidad_Unidades = !Cantidad_Unidades - Me.txtunidades_in
Me.txtcantidad_bultos = Rs!Cantidad_Bultos
Me.txtcantidad_unidades = Rs!Cantidad_Unidades
Forms!frm_lista_productos.txtbultos.Requery
Forms!frm_lista_productos.txtunidades.Requery
Forms!frm_stock_detalle.txtbultos = Rs!Cantidad_Bultos
Forms!frm_stock_detalle.txtunidades = Rs!Cantidad_Unidades
.Update
End With
Rs.Close
Set Rs = Nothing
MsgBox "EL STOCK DE MODIFICO CORRECTAMENTE", vbInformation, "AVISO"
Me.txtbultos_in.Value = ""
Me.txtbultos_in.Value = Null
Me.txtunidades_in.Value = ""
Me.txtunidades_in.Value = Null
Me.txtbultos_in.SetFocus
End If
End If
End Sub
Valora esta pregunta


0