Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

first,previous,next,last Recordset using VB .net

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,

Former Member
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question