This example will override the grid button click on the Inventory Maintenance form, and cause the advanced search form to load for inventory selection - in fact the same one that is loaded on the sales order form.
This example is obviously not very practical, but it does show simply how to use this search function.
You can create your own searches by populating the tables SY_SearchTypes, SY_SearchQueries and SY_SearchColumns - and you invoke it the same way as the example below, but just provide the name you gave your search in the SY_SearchTypes instead.
- Code: Select all
' Form Grid ButtonClick Before breakout
rtnCancel = True
Dim LookupUI
Dim MyLoop
Set LookupUI = CreateObject("JiwaLookupUI.StdFunctions")
Set LookupUI.Database = InventoryObject.Database
Set LookupUI.myOwnerForm = FormObject
' Set some pre-typed keystrokes...
LookupUI.PreTypedKeys = "abc"
If LookupUI.Setup(1, "Sales Orders Inventory", "Sales Order Lines Lookup") Then
LookupUI.Show
If LookupUI.ExposedForm.Search.Results.Count > 0 Then
' Process Results
For MyLoop = 1 To LookupUI.ExposedForm.Search.Results.Count
MsgBox LookupUI.ExposedForm.Search.Results(MyLoop).Fields("InventoryID").Value
Next
End If
End If
Set LookupUI = Nothing
End Sub