on 11-03-2015 5:35 AM
Hi guys,
I created a recordset,
oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
oRecordSet.DoQuery("Select ""ItemCode"",""ItemName"" FROM OITM ORDER BY ""ItemName"" ")
then after that, I created a first,previous,next,last buttons,
Select Case pVal.ItemUID
Case "btnfirst" 'btnFirst
oRecordSet.MoveFirst()
Case "btnprev"
If Not oRecordSet.BoF Then
oRecordSet.MovePrevious()
Else
oRecordSet.MoveLast()
End If
Case "btnnext"
oRecordSet.MoveNext()
If oRecordSet.EoF Then
oRecordSet.MoveFirst()
End If
Case "btnlast"
oRecordSet.MoveLast()
End Select
All my buttons works properly,
now.. I want to create a textbox... on which i can search the itemcode on recordset.. my question is... how to set the recordset on that ItemCode so that if i click the Buttons, ill get the correct output,,
THANKS,
Hi,
You may try, oTextBox.Value = oRecSet.Fields.Item("ItemCode").Value
Regards,
Bry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi bryan,
thanks for the reply but that is not my concern.. let me give an example
i have a recordset of items,
item1
item2
item3
item4
item5
this is the data of my recordset.
now.. i click FIRST button, the OUTPUT is ITEM1.
then.. i click NEXT button, the OUTPUT is ITEM2.
then.. i click NEXT button, the OUTPUT is ITEM3.
then.. i click LAST button, the OUTPUT is ITEM5.
then.. i click PREVIOUS button, the OUTPUT is ITEM4.
so remember.. my last ouput is ITEM4..
i have a textbox for searching items... i search ITEM1 on my recorset. of course the OUTPUT is ITEM1.
NOW, when i click the NEXT BUTTON, my OUTPUT is ITEM5..... which is wrong...
the OUTPUT should be ITEM2...because i searched the ITEM1 right? si if i click the NEXT button.. the OUTPUT should be ITEM2, and if i click the PREVIOUS button, the OUTPUT should be ITEM5.
that is my problem when searching an item.
PLEASE HELP
Weynard,
If I understood , is because you aren't navigate in your recordset until the register that you need.
You can try something like this(is not beautiful, but i think it's solve your problem):
Case SAPbouiCOM.BoEventTypes.et_KEY_DOWN
Select Case pVal.ItemUID
Case "txtItmCode"
If pVal.CharPressed = "13" Then
oForm.Freeze(True)
ItemCode = oForm.Items.Item("txtItmCode").Specific.value
while(ItemCode != oRecordSet.Fields.Item("ItemCode").Value)
oRecordSet.MoveNext()
If oRecordSet.EoF Then
oRecordSet.MoveFirst()
End If
End while
End Select
End Select
Regards,
Diego
HI Diego,
I did the same logic.
oRecordSet.MoveFirst()
Do
oRecordSet.MoveNext()
Loop Until (oRecordSet.Fields.Item(0).Value = ItemCode)
but this is too slow to load the data... imagine that you have 300 thousands records.. if i choose the last record.. it will loop 300thousand times.. do you have any codes to avoid this loop?
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.