Method
Opens a table and creates a handle to it.
Category
Tables
Syntax
Function OpenTable(ByRef hTableRef As Long, ByVal TableNo As Long)
As Boolean
hTableRef
A new handle to the table.
TableNo
Number of the table to be opened.
Example
'Opens table
tmpVar = CF1.OpenTable(hTable, 15)
If VarType(tmpVar) = vbBoolean Then
logWr "OpenTable OK"
Else
logWr "OpenTable failed. It didn't return a boolean"
End If
Comments
OpenTable opens the table identified by TableNo and assigns a
handle to it for future calls. The handle remains valid until
CloseTable is invoked. You can
create several handles to the same table and, using other library
functions, set filters and a current key individually for each
handle.
Even if a user (verified by Login) does not have permission to access the table, OpenTable will open it anyway. But the application will receive an error when it tries to read or modify the table. Only the table description (field and key layout) can be accessed, not the table data.
If the table is successfully opened, the function returns TRUE. If the table does not exist, two things can happen:
The function returns FALSE, and, unless the error has been allowed, an error message will be displayed if HideError is FALSE.
If this result has been allowed by the AllowTableNotFound function, it will not be considered an error. The function, however, still returns FALSE; and you should test this return value in your code.
For more information about how errors are handled, see Error Handling.
For more information about tables, see the Application Designer's Guide.