mi mensaje se borra solo
Publicado por PARCERO (8 intervenciones) el 04/08/2006 20:10:31
Hola..mi problema es el siguiente :
tengo una caja de texto q programe en el evento change para cuando me lea un codigo de articulo me compruebe si existe esto si el len(text1) = 5 ,...el problema esq cuando ingreso el codigo por el teclado y el codigo no existe entonces me envia un msgbox diciendome q no existe hasta ahi correcto, pero cuando lo ingreso leyendo con un scaner de codigo de barras no me muestra el msgbox ..y solo prosigue la aplicacion que puedo hacer cual es el erro urgente ...ahi les dejo el codigo....
Dim newli As ListItem
Dim ART As ADODB.Recordset
Dim AG As String
Dim CANT As Integer
Public I As Integer
Private Sub CMDNUEVO_Click()
CANT = 0
End Sub
Private Sub Form_Load()
FRMCERO Me
lblFECHA.Caption = Format(Now, "DD/MM/YYYY")
lblVENDEDOR.Caption = USUARIO
lblPTOVENTA.Caption = TIENDA
End Sub
Private Sub Form_Unload(Cancel As Integer)
CANT = 0
End Sub
Private Sub txtCODART_Change()
If Len(UCase(txtCODART)) = 5 Then
AG = UCase(txtCODART.Text)
AGREGA
If CANT = 1 Then
Set ART = New ADODB.Recordset
ART.CursorLocation = adUseClient
ART.Open "SELECT * FROM ALM_PROD_TER WHERE COD_ART='" & UCase(txtCODART.Text) & "'", cn, adOpenDynamic, adLockOptimistic
If ART.RecordCount > 0 Then
Set newli = lwVENTAS_ALM.ListItems.Add
newli.Text = ART(0)
newli.SubItems(1) = ART(2)
newli.SubItems(2) = ART(3)
newli.SubItems(3) = ART(5)
newli.SubItems(4) = ART(7)
newli.SubItems(5) = CANT 'ART(9)
newli.SubItems(6) = ART(8)
' newli.SubItems(7) = ART()
Else
MsgBox "EL CODIGO INGRESADO NO EXISTE", vbCritical, Me.Caption
Exit Sub
End If
ElseIf CANT > 1 Then
Set ART = New ADODB.Recordset
ART.CursorLocation = adUseClient
ART.Open "SELECT * FROM ALM_PROD_TER WHERE COD_ART='" & UCase(txtCODART.Text) & "'", cn, adOpenDynamic, adLockOptimistic
Set newli = lwVENTAS_ALM.ListItems.Add
newli.Text = ART(0)
newli.SubItems(1) = ART(2)
newli.SubItems(2) = ART(3)
newli.SubItems(3) = ART(5)
newli.SubItems(4) = ART(7)
newli.SubItems(5) = CANT 'ART(9)
newli.SubItems(6) = ART(8)
' newli.SubItems(7) = ART()
End If
End If
End Sub
Private Sub CORRELATIVO()
Dim RSCOD As ADODB.Recordset
Set RSCOD = New ADODB.Recordset
RSCOD.CursorLocation = adUseClient
RSCOD.Open "SELECT NUM_GUIA FROM GUIA_REMISION", cn, adOpenDynamic, adLockOptimistic
If RSCOD.RecordCount > 0 Then
RSCOD.MoveLast
Dim NUM As Integer
Dim COD As String
NUM = CInt(Right(RSCOD(0), 6)) + 1
COD = "001-" & Format(NUM, "000000")
LBLNUMGUIA.Caption = COD
Else
COD = "001-000001"
LBLNUMGUIA.Caption = COD
End If
End Sub
Private Sub LIMPIAR()
For Each Control In Me
If TypeOf Control Is TextBox Then
Control.Text = ""
ElseIf TypeOf Control Is ComboBox Then
Control.Text = ""
End If
Next Control
LWGUIA.ListItems.Clear
End Sub
Private Sub DESABILITA_CMD()
For Each Control In Me
If TypeOf Control Is CommandButton Then
Control.Enabled = False
End If
Next Control
End Sub
Private Sub AGREGA()
Dim tItem As ListItem
For I = 1 To lwVENTAS_ALM.ListItems.Count
If lwVENTAS_ALM.ListItems(I).Text = AG Then
CANT = lwVENTAS_ALM.ListItems(I).SubItems(5)
lwVENTAS_ALM.ListItems.Remove I
CANT = CANT + 1
Exit Sub
End If
Next
CANT = 1
End Sub
tengo una caja de texto q programe en el evento change para cuando me lea un codigo de articulo me compruebe si existe esto si el len(text1) = 5 ,...el problema esq cuando ingreso el codigo por el teclado y el codigo no existe entonces me envia un msgbox diciendome q no existe hasta ahi correcto, pero cuando lo ingreso leyendo con un scaner de codigo de barras no me muestra el msgbox ..y solo prosigue la aplicacion que puedo hacer cual es el erro urgente ...ahi les dejo el codigo....
Dim newli As ListItem
Dim ART As ADODB.Recordset
Dim AG As String
Dim CANT As Integer
Public I As Integer
Private Sub CMDNUEVO_Click()
CANT = 0
End Sub
Private Sub Form_Load()
FRMCERO Me
lblFECHA.Caption = Format(Now, "DD/MM/YYYY")
lblVENDEDOR.Caption = USUARIO
lblPTOVENTA.Caption = TIENDA
End Sub
Private Sub Form_Unload(Cancel As Integer)
CANT = 0
End Sub
Private Sub txtCODART_Change()
If Len(UCase(txtCODART)) = 5 Then
AG = UCase(txtCODART.Text)
AGREGA
If CANT = 1 Then
Set ART = New ADODB.Recordset
ART.CursorLocation = adUseClient
ART.Open "SELECT * FROM ALM_PROD_TER WHERE COD_ART='" & UCase(txtCODART.Text) & "'", cn, adOpenDynamic, adLockOptimistic
If ART.RecordCount > 0 Then
Set newli = lwVENTAS_ALM.ListItems.Add
newli.Text = ART(0)
newli.SubItems(1) = ART(2)
newli.SubItems(2) = ART(3)
newli.SubItems(3) = ART(5)
newli.SubItems(4) = ART(7)
newli.SubItems(5) = CANT 'ART(9)
newli.SubItems(6) = ART(8)
' newli.SubItems(7) = ART()
Else
MsgBox "EL CODIGO INGRESADO NO EXISTE", vbCritical, Me.Caption
Exit Sub
End If
ElseIf CANT > 1 Then
Set ART = New ADODB.Recordset
ART.CursorLocation = adUseClient
ART.Open "SELECT * FROM ALM_PROD_TER WHERE COD_ART='" & UCase(txtCODART.Text) & "'", cn, adOpenDynamic, adLockOptimistic
Set newli = lwVENTAS_ALM.ListItems.Add
newli.Text = ART(0)
newli.SubItems(1) = ART(2)
newli.SubItems(2) = ART(3)
newli.SubItems(3) = ART(5)
newli.SubItems(4) = ART(7)
newli.SubItems(5) = CANT 'ART(9)
newli.SubItems(6) = ART(8)
' newli.SubItems(7) = ART()
End If
End If
End Sub
Private Sub CORRELATIVO()
Dim RSCOD As ADODB.Recordset
Set RSCOD = New ADODB.Recordset
RSCOD.CursorLocation = adUseClient
RSCOD.Open "SELECT NUM_GUIA FROM GUIA_REMISION", cn, adOpenDynamic, adLockOptimistic
If RSCOD.RecordCount > 0 Then
RSCOD.MoveLast
Dim NUM As Integer
Dim COD As String
NUM = CInt(Right(RSCOD(0), 6)) + 1
COD = "001-" & Format(NUM, "000000")
LBLNUMGUIA.Caption = COD
Else
COD = "001-000001"
LBLNUMGUIA.Caption = COD
End If
End Sub
Private Sub LIMPIAR()
For Each Control In Me
If TypeOf Control Is TextBox Then
Control.Text = ""
ElseIf TypeOf Control Is ComboBox Then
Control.Text = ""
End If
Next Control
LWGUIA.ListItems.Clear
End Sub
Private Sub DESABILITA_CMD()
For Each Control In Me
If TypeOf Control Is CommandButton Then
Control.Enabled = False
End If
Next Control
End Sub
Private Sub AGREGA()
Dim tItem As ListItem
For I = 1 To lwVENTAS_ALM.ListItems.Count
If lwVENTAS_ALM.ListItems(I).Text = AG Then
CANT = lwVENTAS_ALM.ListItems(I).SubItems(5)
lwVENTAS_ALM.ListItems.Remove I
CANT = CANT + 1
Exit Sub
End If
Next
CANT = 1
End Sub
Valora esta pregunta


0