Specifies that an error will not be caused if a key that is being requested cannot be found.
CF1.HideError = False
CF1.OpenTable hTable, CLng(frmCfrontTest.Text1(cf.TableNoCreate).Text)
longArray(0) = 1
longArray(1) = 2 'not a key
longArray(2) = 0
tmpVar = longArray
tmpVar2 = CF1.SetCurrentKey(hTable, tmpVar)
If tmpVar2 = False Then
logWr "AllowKeyNotFound OK"
logWr "AllowKeyNotFound failed"
This function only allows the error to occur for one function call. It must be set each time you want to use it (as opposed to disabling the error for your application as a whole).
This function works as if HideError had been set to TRUE before a function that tries to use a key is called, and HideError is reset to FALSE afterwards. This means that it is shorthand for a construction like the following (where Cf is a C/FRONT OCX object):
Cf.HideError = TRUE
Cf.HideError = FALSE
Using this function also means that LastError cannot be used to retrieve an error code. You have to use the return value of the function, as follows:
Ret = Cf.FunctionThatUsesKey
If Ret <> TRUE Then
' handle error
AllowKeyNotFound affects the SetCurrentKey function.