When Pressing Tab (updated)
:confused: I AM TRYING TO CODE A LOOKUP WHEN TAB IS PRESSED BUT THE LOOKUP ONLY OCCURS WHEN FOCUS IS LOST. ANYBODY HAVE ANY IDEAS.
'RESPOND TO TAB OFF CUSTOMER ID on Order Entry window WHEN IN "ADD" MODE
If pVal.FormType = 139 And pVal.FormMode = fm_ADD_MODE Then
Set frm = applic.Forms.Item(FormUID)
'When tab off of the Item Code ("Item") field and a message box appears.
If pVal.ItemUID = "38" And pVal.ColUID = "1" Then
Dim txtCCode As EditText
Dim sCCode As String
Dim oMatrix As SAPbouiCOm.Matrix
Dim oColumns As SAPbouiCOm.Columns
Dim oColumn As SAPbouiCOm.Column
'// first, get the form's matrix object
Set oMatrix = frm.Items.Item("38").Specific
Set oColumns = oMatrix.Columns
'// get the matrix columns by the UID
'// bind items to the DB data source here:
Set oColumn = oColumns.Item("1")
Set txtCCode = oColumn.Cells.Item(1).Specific
sCCode = txtCCode.String
If IsCustomerQualified(sCCode) = False Then
Dim ofrm As SAPbouiCOm.Form
Set ofrm = applic.Forms.Item("frm_" & Str(pApp.Forms.Count))
rc = applic.MessageBox("The Item does not exist. Please re-enter the item code")
BubbleEvent = False
End If
Re: When Pressing Tab (updated)
Where is this code being run?
I would suggest using the Validate event of the control (which is fired just before the focus is changed), then instead of "BubbleEvent = False" you can use "Cancel = True" to make sure they cant leave the control until the data is valid.