Billybonga
IS-IT--Management
I'm writing an application that uses allows me to receive data from a PiccoLink wireless barcode scanner.
I'm have difficulty searching and displaying data from a table. What I want to do is, on the hand held scanner there is a Supplier field. If the user does not enter a supplier field then it will display a list of all suppliers from the database from which they can select.
The system works in two halves, the PiccoLink form and then the datafrom processing.
Here is the code I am using:
Private Sub DataFromDelEntry(ByVal id As Long) ' Delivery Entry Data Processing
Dim retval As Boolean
Dim date_id As String
Dim del_id As String
Dim supplier As Long
Dim counter As Integer
If PLServer1.IsData(id, BACK_BUT) Then
SendMainMenu (id)
Exit Sub
End If
date_id = Date
del_id = PLServer1.GetData(id, DEL_REF_POS) 'Get delivery Id from data sent by scanner
supplier = Val(PLServer1.GetData(id, DEL_SUPP_POS)) 'Set the supplier input data
If supplier = 0 Then ' if no data for supplier is inputted then
'get db record of hand terminal
searchstr = "Name = '" & supplier & "'" 'create a search string from data table searching for supplier 'Name'
Data5.Recordset.FindFirst searchstr
PLServer1.ClearForm (id) 'Clear the scanner form
retval = PLServer1.Text(id, 0, "Select Supplier") ' Display form - Select Supplier
retval = PLServer1.Button(id, BACK_BUT, Chr(164) + Chr(165)) ' Display back button
Data5.Recordset.MoveFirst ' cycle data table
Do While Data5.Recordset.EOF = False
If supplier <> Data5.Recordset!Name Then
counter = counter + 1
retval = PLServer1.Button(id, (counter * 20), Str(Data5.Recordset!Name))
End If
Data5.Recordset.MoveNext
If (counter >= 10) Then Exit Do
Loop
retval = PLServer1.Send(id, supplier)
End If
End Sub
When run, it errors saying Runtime Error 13 - Type Mismatch and then highlights line :
retval = PLServer1.Button(id, (counter * 20), Str(Data5.Recordset!Name))
Can anyone see where I'm going wrong?
Thanks for the help
I'm have difficulty searching and displaying data from a table. What I want to do is, on the hand held scanner there is a Supplier field. If the user does not enter a supplier field then it will display a list of all suppliers from the database from which they can select.
The system works in two halves, the PiccoLink form and then the datafrom processing.
Here is the code I am using:
Private Sub DataFromDelEntry(ByVal id As Long) ' Delivery Entry Data Processing
Dim retval As Boolean
Dim date_id As String
Dim del_id As String
Dim supplier As Long
Dim counter As Integer
If PLServer1.IsData(id, BACK_BUT) Then
SendMainMenu (id)
Exit Sub
End If
date_id = Date
del_id = PLServer1.GetData(id, DEL_REF_POS) 'Get delivery Id from data sent by scanner
supplier = Val(PLServer1.GetData(id, DEL_SUPP_POS)) 'Set the supplier input data
If supplier = 0 Then ' if no data for supplier is inputted then
'get db record of hand terminal
searchstr = "Name = '" & supplier & "'" 'create a search string from data table searching for supplier 'Name'
Data5.Recordset.FindFirst searchstr
PLServer1.ClearForm (id) 'Clear the scanner form
retval = PLServer1.Text(id, 0, "Select Supplier") ' Display form - Select Supplier
retval = PLServer1.Button(id, BACK_BUT, Chr(164) + Chr(165)) ' Display back button
Data5.Recordset.MoveFirst ' cycle data table
Do While Data5.Recordset.EOF = False
If supplier <> Data5.Recordset!Name Then
counter = counter + 1
retval = PLServer1.Button(id, (counter * 20), Str(Data5.Recordset!Name))
End If
Data5.Recordset.MoveNext
If (counter >= 10) Then Exit Do
Loop
retval = PLServer1.Send(id, supplier)
End If
End Sub
When run, it errors saying Runtime Error 13 - Type Mismatch and then highlights line :
retval = PLServer1.Button(id, (counter * 20), Str(Data5.Recordset!Name))
Can anyone see where I'm going wrong?
Thanks for the help