Rads R
asked on
Barcode scanner issues
I have a barcode scanner and earlier I was working on a projecy which was on a desktop with a ps2 wedge cable and not i attached a usb cable to make it compatible to work for a usb port
when I run the same project which was working excellent on a desktop ... now on a laptop
it does not recognize the barcodes .. well it does show the values in a notepad and also when I create a new form in the same project and take a textbox, label and make it scan in the text and display the value in the label and it displays fine on the new form ...... but when it comes to the existing project ( old form) it does not display the value of the barcode in the label .... i changed the property of the label which was set as locked = true to locked=false but still it does not show up the value in the label .... anyone's help is greatly appreciated
and I need to start a new project on the same streamline ...!! its urgent !!
Thanks
in the label
when I run the same project which was working excellent on a desktop ... now on a laptop
it does not recognize the barcodes .. well it does show the values in a notepad and also when I create a new form in the same project and take a textbox, label and make it scan in the text and display the value in the label and it displays fine on the new form ...... but when it comes to the existing project ( old form) it does not display the value of the barcode in the label .... i changed the property of the label which was set as locked = true to locked=false but still it does not show up the value in the label .... anyone's help is greatly appreciated
and I need to start a new project on the same streamline ...!! its urgent !!
Thanks
in the label
Are you sure that your application has the focus set to a control that accept keyboard input when you try to scan?
ASKER
Yes it has the focus...!
ASKER
it is taking only the second character from the barcode value and nothing else when i debug the application now
do you have any code that could cause interference.
to make a quick test, create a new form, add a textbox, run the application, set the focus to the textbox and scan. if it is working in Notepad, it should work in your application.
to make a quick test, create a new form, add a textbox, run the application, set the focus to the textbox and scan. if it is working in Notepad, it should work in your application.
ASKER
now it does scan but it takes only one of the characters from the barcode scanner and not the entire string ... actually i did try that too and it is taking everyhting in to the textbox on the new form but not on the old form .... in the same project i created a added a form and placed a textbox, label and a button
and as by default when i scan the focus goes to textbox and when i press the button it is displaying the label ... i wrote in the button_click as
label1.caption = text1.text
and this works fine
and as by default when i scan the focus goes to textbox and when i press the button it is displaying the label ... i wrote in the button_click as
label1.caption = text1.text
and this works fine
that means that you surely have code that inteferes.
can you show your code?
Why do you need to display in a label if you already have it in the textbox?
can you show your code?
Why do you need to display in a label if you already have it in the textbox?
ASKER
textbox is an interface to store all the values before it displays on the label and it also avoids the users
not to play around if it is a textbox ... for security purposes they have used a label so it does not have the navigation and that textbox is hidden on the form under one of the controls
not to play around if it is a textbox ... for security purposes they have used a label so it does not have the navigation and that textbox is hidden on the form under one of the controls
ASKER
the code is too long to be copied here ...!
If you can't/don't want to show code, it will be very hard to help.
look carefully at all the events of the textbox. is there any that runs code (like the TextChanged)?
look carefully at all the events of the textbox. is there any that runs code (like the TextChanged)?
ASKER
yes
ASKER
this is the code in that
On Error GoTo Err_txtScan_Change
Start_Scan:
If Me.txtscan.Text = "" Then Exit Sub
'Just bail if batch is complete. User must complete batch first
If m_blnBatchComp = True Then Exit Sub
strBarcode = Trim(Me.txtscan.Text)
'If barcode length is 26 then that means it is array scanning
If Len(strBarcode) = Len_Barcode Then
'Parse Barcode for array scanning
Call ParseHeader(strBarcode)
'Validate lotno against header lotno
strType = GetDataType(g_strlotnumber )
'If single load i.e if m_intMaxIndex=1 call twice.once for box & then for pouch
strData = ParseBarcode(g_strlotnumbe r, strType, m_blnBegin)
intIndex = DisplayData(strData, strType, m_intCurrIndex)
Else
'Header scanning checking for valid UPN and LOTNO
MsgBox Me.txtscan.Text
strType = GetDataType(Me.txtscan.Tex t)
If (Me.txtscan.Text) Then
S_Lotno = Trim(Me.txtscan.Text)
Me.lblUPN.Caption = S_Partno
Me.lblLotno.Caption = S_Lotno
'Else
' strMsg = "YOU HAVE SCANNED AN INVALID LOTNO ..... PLEASE SCAN A VALID ONE !!! "
'strTitle = "Invalid Lotno"
'intresponse = MsgBox(strMsg, vbCritical + vbOKOnly + vbDefaultButton1, strTitle)
End If
End If
' Added for Pouches counter
If CheckData(strData, intIndex) = True Then
If intIndex < 6 Then
If strType = "Other" Then
If g_gv = intIndex Then
m_intPouches = m_intPouches
g_gv = 0
Else
Me.lblPouchComp.Caption = m_intPouches + 1
m_intPouches = m_intPouches + 1
g_gv = 0
End If
End If
End If
End If
If intIndex > m_intMaxIndex Then
'Write the data
' An handle write error in db
rewrite = True
While rewrite
blnGoodWrite = WriteRecs()
If blnGoodWrite = True Then
rewrite = False
m_intCurrIndex = 0
Call UpdateForm
Else
ans = MsgBox("Access is denied or Sql Server does not exist...." & _
vbCrLf & "Choose RETRY or CANCEL ", vbRetryCancel, "Database not available ")
If ans = vbCancel Then
ans = MsgBox("ARE YOU SURE YOU WANT TO CANCEL THE BATCH?", vbYesNo, "CANCEL CONFIRM")
If ans = vbYes Then
rewrite = False
Unload Me
Exit Sub
Else
rewrite = True
End If
End If
End If
Wend
Else
'Just increment the current index if we are in the field
If Not m_blnBegin Then m_intCurrIndex = intIndex
End If
'TODO: Add supervisor form. Add label to flash
Me.lblGoodScan.Visible = False
Me.lblBumScan.Visible = False
'If complete, automatically go to batch complete routine
If Val(Me.lblQtyComp.Caption) > 0 And _
(Val(Me.lblQtyComp.Caption ) = Val(Me.lblBatchQty.Caption )) Then
Call HideShowArray(0, 6, False)
MsgBox " YOUR BATCH IS COMPLETED ", vbOKOnly, "Batch Completed"
m_blnBatchComp = True
Me.sts.Panels("Prompt").Te xt = " Batch Completed "
Else 'Set highlight and prompt
Call SetHighlight(m_intCurrInde x)
End If
Exit_txtScan_Change:
On Error Resume Next
Me.txtscan.Text = ""
Exit Sub
Err_txtScan_Change:
'MsgBox Err.Number & ": " & Err.Description
If Err.Number = -2147467259 Then
ans = MsgBox("Access is denied or Sql Server does not exist...." & _
vbCrLf & "Choose RETRY or CANCEL ", vbRetryCancel, "Database not Available ")
If ans = vbCancel Then
ans = MsgBox("ARE YOU SURE YOU WANT TO CANCEL ?", vbYesNo, "CANCEL CONFIRM")
If ans = vbYes Then
Unload Me
End
Exit Sub
End If
Else
GoTo Start_Scan
End If
End If
Resume Exit_txtScan_Change
On Error GoTo Err_txtScan_Change
Start_Scan:
If Me.txtscan.Text = "" Then Exit Sub
'Just bail if batch is complete. User must complete batch first
If m_blnBatchComp = True Then Exit Sub
strBarcode = Trim(Me.txtscan.Text)
'If barcode length is 26 then that means it is array scanning
If Len(strBarcode) = Len_Barcode Then
'Parse Barcode for array scanning
Call ParseHeader(strBarcode)
'Validate lotno against header lotno
strType = GetDataType(g_strlotnumber
'If single load i.e if m_intMaxIndex=1 call twice.once for box & then for pouch
strData = ParseBarcode(g_strlotnumbe
intIndex = DisplayData(strData, strType, m_intCurrIndex)
Else
'Header scanning checking for valid UPN and LOTNO
MsgBox Me.txtscan.Text
strType = GetDataType(Me.txtscan.Tex
If (Me.txtscan.Text) Then
S_Lotno = Trim(Me.txtscan.Text)
Me.lblUPN.Caption = S_Partno
Me.lblLotno.Caption = S_Lotno
'Else
' strMsg = "YOU HAVE SCANNED AN INVALID LOTNO ..... PLEASE SCAN A VALID ONE !!! "
'strTitle = "Invalid Lotno"
'intresponse = MsgBox(strMsg, vbCritical + vbOKOnly + vbDefaultButton1, strTitle)
End If
End If
' Added for Pouches counter
If CheckData(strData, intIndex) = True Then
If intIndex < 6 Then
If strType = "Other" Then
If g_gv = intIndex Then
m_intPouches = m_intPouches
g_gv = 0
Else
Me.lblPouchComp.Caption = m_intPouches + 1
m_intPouches = m_intPouches + 1
g_gv = 0
End If
End If
End If
End If
If intIndex > m_intMaxIndex Then
'Write the data
' An handle write error in db
rewrite = True
While rewrite
blnGoodWrite = WriteRecs()
If blnGoodWrite = True Then
rewrite = False
m_intCurrIndex = 0
Call UpdateForm
Else
ans = MsgBox("Access is denied or Sql Server does not exist...." & _
vbCrLf & "Choose RETRY or CANCEL ", vbRetryCancel, "Database not available ")
If ans = vbCancel Then
ans = MsgBox("ARE YOU SURE YOU WANT TO CANCEL THE BATCH?", vbYesNo, "CANCEL CONFIRM")
If ans = vbYes Then
rewrite = False
Unload Me
Exit Sub
Else
rewrite = True
End If
End If
End If
Wend
Else
'Just increment the current index if we are in the field
If Not m_blnBegin Then m_intCurrIndex = intIndex
End If
'TODO: Add supervisor form. Add label to flash
Me.lblGoodScan.Visible = False
Me.lblBumScan.Visible = False
'If complete, automatically go to batch complete routine
If Val(Me.lblQtyComp.Caption)
(Val(Me.lblQtyComp.Caption
Call HideShowArray(0, 6, False)
MsgBox " YOUR BATCH IS COMPLETED ", vbOKOnly, "Batch Completed"
m_blnBatchComp = True
Me.sts.Panels("Prompt").Te
Else 'Set highlight and prompt
Call SetHighlight(m_intCurrInde
End If
Exit_txtScan_Change:
On Error Resume Next
Me.txtscan.Text = ""
Exit Sub
Err_txtScan_Change:
'MsgBox Err.Number & ": " & Err.Description
If Err.Number = -2147467259 Then
ans = MsgBox("Access is denied or Sql Server does not exist...." & _
vbCrLf & "Choose RETRY or CANCEL ", vbRetryCancel, "Database not Available ")
If ans = vbCancel Then
ans = MsgBox("ARE YOU SURE YOU WANT TO CANCEL ?", vbYesNo, "CANCEL CONFIRM")
If ans = vbYes Then
Unload Me
End
Exit Sub
End If
Else
GoTo Start_Scan
End If
End If
Resume Exit_txtScan_Change
This is too much code! Comment it out and it will work!
Your scanner can be programmed to send a Tab when the scanning is complete. The only code should go into the LostFocus event.
Your scanner can be programmed to send a Tab when the scanning is complete. The only code should go into the LostFocus event.
ASKER
On Error GoTo Err_txtScan_Change
Start_Scan:
If Me.txtscan.Text = "" Then Exit Sub
'Just bail if batch is complete. User must complete batch first
If m_blnBatchComp = True Then Exit Sub
strBarcode = Trim(Me.txtscan.Text)
'If barcode length is 26 then that means it is array scanning
If Len(strBarcode) = Len_Barcode Then
'Parse Barcode for array scanning
Call ParseHeader(strBarcode)
'Validate lotno against header lotno
strType = GetDataType(g_strlotnumber )
'If single load i.e if m_intMaxIndex=1 call twice.once for box & then for pouch
strData = ParseBarcode(g_strlotnumbe r, strType, m_blnBegin)
intIndex = DisplayData(strData, strType, m_intCurrIndex)
Else
'Header scanning checking for valid UPN and LOTNO
MsgBox Me.txtscan.Text
strType = GetDataType(Me.txtscan.Tex t)
If (Me.txtscan.Text) Then
S_Lotno = Trim(Me.txtscan.Text)
Me.lblUPN.Caption = S_Partno
Me.lblLotno.Caption = S_Lotno
'Else
' strMsg = "YOU HAVE SCANNED AN INVALID LOTNO ..... PLEASE SCAN A VALID ONE !!! "
'strTitle = "Invalid Lotno"
'intresponse = MsgBox(strMsg, vbCritical + vbOKOnly + vbDefaultButton1, strTitle)
End If
End If
this is where it strBarcode = Trim(Me.txtscan.Text) it assigns the value of the scanned to a variable
Start_Scan:
If Me.txtscan.Text = "" Then Exit Sub
'Just bail if batch is complete. User must complete batch first
If m_blnBatchComp = True Then Exit Sub
strBarcode = Trim(Me.txtscan.Text)
'If barcode length is 26 then that means it is array scanning
If Len(strBarcode) = Len_Barcode Then
'Parse Barcode for array scanning
Call ParseHeader(strBarcode)
'Validate lotno against header lotno
strType = GetDataType(g_strlotnumber
'If single load i.e if m_intMaxIndex=1 call twice.once for box & then for pouch
strData = ParseBarcode(g_strlotnumbe
intIndex = DisplayData(strData, strType, m_intCurrIndex)
Else
'Header scanning checking for valid UPN and LOTNO
MsgBox Me.txtscan.Text
strType = GetDataType(Me.txtscan.Tex
If (Me.txtscan.Text) Then
S_Lotno = Trim(Me.txtscan.Text)
Me.lblUPN.Caption = S_Partno
Me.lblLotno.Caption = S_Lotno
'Else
' strMsg = "YOU HAVE SCANNED AN INVALID LOTNO ..... PLEASE SCAN A VALID ONE !!! "
'strTitle = "Invalid Lotno"
'intresponse = MsgBox(strMsg, vbCritical + vbOKOnly + vbDefaultButton1, strTitle)
End If
End If
this is where it strBarcode = Trim(Me.txtscan.Text) it assigns the value of the scanned to a variable
If I am not mistaken, the Change event occurs for every scanned character. To be sure, comment out all the code you currently have and add "debug.writeline txtScan.Text" and run your application.
Do you see all the textbox text content growing in the immediate window?
You cannot have all that code in that event.
Do you see all the textbox text content growing in the immediate window?
You cannot have all that code in that event.
ASKER
no sometimes it shows only the first character in the string and sometimes it shows only 2 character
but does not show the entire string
but does not show the entire string
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
close the question