AllowRecordNotFound

Method
Specifies that not finding a record will not cause an error.

Category
Errors

 

Syntax
Sub AllowRecordNotFound

 

Example

  CF1.OpenTable hTable, CLng(frmCfrontTest.Text1(cf.TableNoCreate).Text)

  hRecord = CF1.AllocRec(hTable)

  CF1.AssignField hTable, hRecord, 1, "Garfield"

  CF1.AllowRecordNotFound

  tmpVar2 = CF1.FindRec(hTable, hRecord, "=")

  If tmpVar2 = False Then

  logWr "AllowRecordNotFound OK"

  Else

  logWr "AllowRecordNotFound failed"

  End If

  CF1.FreeRec hRecord

  CF1.CloseTable hTable

 

Comments
This function only allows the error 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 access a record 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.FunctionThatSearchesForRecord

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:

Cf.AllowRecordNotFound
Ret = Cf.FunctionThatSearchesForRecord

If Ret <> TRUE Then

  ' handle error

AllowRecordNotFound affects the DeleteRec, FindRec and NextRec functions.



© 2009 Microsoft Corporation. All rights reserved.