Billybonga
IS-IT--Management
I'm trying to display enteries of a database in a list in multiples of 7 lines. (I'm using a handheld scanner that display a maximum of 10 lines)
I have two "scroll buttons" for going forward to the next 7 or back to the previous 7. I know a bit about VB but not to the advanced level so any help is appreciated.
I am able to display the first 7 enteries, but can't get it to display the next or previous enteries when i click the << or the >> buttons.
The program is broken into three sections for the scanner to work:
DelEntry is a form entry - Asks the used for Supplier Name, Invoice Number and Clerk User ID.
This data gets passed to DataFromDelEntry:
------------------------------------------------------------
Private Sub DataFromDelEntry(ByVal id As Long) ' Delivery Entry Data Processing
Dim retval As Boolean
Dim supplier As String
Dim counter As Integer
Dim searchstr As String
supplier = Val(PLServer1.GetData(id, DEL_SUPP_POS))
If supplier = 0 Then 'if no supplier in inputted into form ....
searchstr = "Name = '" & supplier & "'" 'setup search string in Supplier database looking for suppliers 'Name'
Data5.Recordset.FindFirst searchstr
PLServer1.ClearForm (id)
retval = PLServer1.Text(id, 0, "SELECT SUPPLIER") ' Display title
Data5.Recordset.MoveFirst
Do While Data5.Recordset.EOF = False
If supplier <> Data5.Recordset!Name Then
counter = counter + 1
retval = PLServer1.Button(id, (counter * 20), Data5.Recordset!Name)
End If
Data5.Recordset.MoveNext
If (counter >= 7) Then Exit Do 'sets the display on screen to only 7 lines
Loop
retval = PLServer1.Button(id, PREV_BTN, "<<") ' Display the Previous Button
retval = PLServer1.Button(id, FWD_BTN, ">>") ' Display the Next Button
retval = PLServer1.Send(id, SELECT_SUPPLIER) ' Send Data with ID Select_Supplier
Exit Sub
End If
End Sub
------------------------------------------------------------
Here tests are run to see if the Supplier Field from the form is empty. If it is empty, it pulls a list of suppliers names from the database!Names (data5)
In this database there are hundreds on names, and since the scanner only handles 10 lines (but I only want to use 7 lines) I have to include previous and next buttons.
Any items/data selected from the list of suppliers names or if the user clicks the << or >> buttons, then their request gets passed to : DataFromSelectSupplier
------------------------------------------------------------
Private Sub PLServer1_DataArrived(ByVal id As Long, ByVal frameid As Integer)
Dim itmstr As String
Dim x As Integer
Dim retval As Boolean
Dim curFormid As Integer
Dim funckey As String
If frameid = -1 Then
funckey = PLServer1.GetData(id, -1) 'F-key is pressed
End If
curFormid = PLServer1.GetFormID(id) 'Get current formid from hand terminal
'MsgBox curFormid
If curFormid = 0 Then
'Hand terminal is resetted or formid has settled as 0
'Let's show first 10 items with hand terminal
Call ShowLines(id, 1, 10)
Exit Sub
End If
If PLServer1.IsData(id, 16) Or funckey = "F3" Then 'data from Back but (<<)?
curFormid = curFormid - 10
Call ShowLines(id, curFormid, curFormid + 10)
Exit Sub
End If
If PLServer1.IsData(id, 18) Or funckey = "F4" Then 'data from next but (>>)?
curFormid = curFormid + 10
Call ShowLines(id, curFormid, curFormid + 10)
Exit Sub
End If
'Item is selected
For x = 1 To 10
If PLServer1.IsData(id, 20 * x) Then
SelItem.Text = PLServer1.GetData(id, 20 * x)
End If
Next x
PLServer1.Bell (id)
retval = PLServer1.Send(id, -1)
End Sub
------------------------------------------------------------
This is where things fail. Since I hacked the code from another app that kind of does the same job but only from a list box rather than a database it may not work.
Can anyone suggest a way the I can display the next/previous 7 supplier names when the user clicks the << or >> buttons??
Thanks for your help, and I hope this hasn't confused anyone too much
I have two "scroll buttons" for going forward to the next 7 or back to the previous 7. I know a bit about VB but not to the advanced level so any help is appreciated.
I am able to display the first 7 enteries, but can't get it to display the next or previous enteries when i click the << or the >> buttons.
The program is broken into three sections for the scanner to work:
DelEntry is a form entry - Asks the used for Supplier Name, Invoice Number and Clerk User ID.
This data gets passed to DataFromDelEntry:
------------------------------------------------------------
Private Sub DataFromDelEntry(ByVal id As Long) ' Delivery Entry Data Processing
Dim retval As Boolean
Dim supplier As String
Dim counter As Integer
Dim searchstr As String
supplier = Val(PLServer1.GetData(id, DEL_SUPP_POS))
If supplier = 0 Then 'if no supplier in inputted into form ....
searchstr = "Name = '" & supplier & "'" 'setup search string in Supplier database looking for suppliers 'Name'
Data5.Recordset.FindFirst searchstr
PLServer1.ClearForm (id)
retval = PLServer1.Text(id, 0, "SELECT SUPPLIER") ' Display title
Data5.Recordset.MoveFirst
Do While Data5.Recordset.EOF = False
If supplier <> Data5.Recordset!Name Then
counter = counter + 1
retval = PLServer1.Button(id, (counter * 20), Data5.Recordset!Name)
End If
Data5.Recordset.MoveNext
If (counter >= 7) Then Exit Do 'sets the display on screen to only 7 lines
Loop
retval = PLServer1.Button(id, PREV_BTN, "<<") ' Display the Previous Button
retval = PLServer1.Button(id, FWD_BTN, ">>") ' Display the Next Button
retval = PLServer1.Send(id, SELECT_SUPPLIER) ' Send Data with ID Select_Supplier
Exit Sub
End If
End Sub
------------------------------------------------------------
Here tests are run to see if the Supplier Field from the form is empty. If it is empty, it pulls a list of suppliers names from the database!Names (data5)
In this database there are hundreds on names, and since the scanner only handles 10 lines (but I only want to use 7 lines) I have to include previous and next buttons.
Any items/data selected from the list of suppliers names or if the user clicks the << or >> buttons, then their request gets passed to : DataFromSelectSupplier
------------------------------------------------------------
Private Sub PLServer1_DataArrived(ByVal id As Long, ByVal frameid As Integer)
Dim itmstr As String
Dim x As Integer
Dim retval As Boolean
Dim curFormid As Integer
Dim funckey As String
If frameid = -1 Then
funckey = PLServer1.GetData(id, -1) 'F-key is pressed
End If
curFormid = PLServer1.GetFormID(id) 'Get current formid from hand terminal
'MsgBox curFormid
If curFormid = 0 Then
'Hand terminal is resetted or formid has settled as 0
'Let's show first 10 items with hand terminal
Call ShowLines(id, 1, 10)
Exit Sub
End If
If PLServer1.IsData(id, 16) Or funckey = "F3" Then 'data from Back but (<<)?
curFormid = curFormid - 10
Call ShowLines(id, curFormid, curFormid + 10)
Exit Sub
End If
If PLServer1.IsData(id, 18) Or funckey = "F4" Then 'data from next but (>>)?
curFormid = curFormid + 10
Call ShowLines(id, curFormid, curFormid + 10)
Exit Sub
End If
'Item is selected
For x = 1 To 10
If PLServer1.IsData(id, 20 * x) Then
SelItem.Text = PLServer1.GetData(id, 20 * x)
End If
Next x
PLServer1.Bell (id)
retval = PLServer1.Send(id, -1)
End Sub
------------------------------------------------------------
This is where things fail. Since I hacked the code from another app that kind of does the same job but only from a list box rather than a database it may not work.
Can anyone suggest a way the I can display the next/previous 7 supplier names when the user clicks the << or >> buttons??
Thanks for your help, and I hope this hasn't confused anyone too much