Opens a table and creates a handle to it.



Function OpenTable(ByRef hTableRef As Long, ByVal TableNo As Long) As Boolean

A new handle to the table.

Number of the table to be opened.



'Opens table

  tmpVar = CF1.OpenTable(hTable, 15)

  If VarType(tmpVar) = vbBoolean Then

  logWr "OpenTable OK"


  logWr "OpenTable failed. It didn't return a boolean"

  End If


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:

For more information about how errors are handled, see Error Handling.

For more information about tables, see the Application Designer's Guide.

© 2009 Microsoft Corporation. All rights reserved.