CreateTableBegin

Method
Creates a create table handle.

Category
Database

 

Syntax
Sub CreateTableBegin(ByRef hCreateTableRef As Long, TableNo As Long, TableName As String, DataPerCompany As Boolean)

hCreateTabelRef
A create table handle.

TableNo
The number of the table.

TableName
The name of the table.

DataPerCompany
If FALSE, the data in the table will be available to all the companies in the database; if TRUE, it will only be available to the currently selected company.

 

 'Creates table Number from Parameter1 and Name from Parameter2

  CF1.CreateTableBegin hTable, CLng(.Text1(cf.TableNoCreate)), .Text1(cf.TableNameCreate), 1

  logWr "CreateTableBegin: " + Str(hTable)

  CF1.AddTableField hTable, 1, "Felt1", 7, 2, "", 0

  CF1.AddTableField hTable, 2, "Felt2", 7, 2, "", 0

  'Adding Key

  IntArray(0) = 1

  IntArray(1) = 2

  IntArray(2) = 0

  KeyArray = IntArray

  CF1.AddKey hTable, KeyArray, KeyArray

  logWr "Addkey result: OK"

  tmpVar = CF1.CreateTable(hTable)

  If VarType(tmpVar) = vbBoolean And tmpVar = True Then

  logWr "CreateTable result: OK"

  Else

  logWr "CreateTable result: Failed"

  End If

  CF1.CreateTableEnd hTable

  logWr "CreateTableEnd: " + Str(hTable)

 

Comments
CreateTableBegin creates a create table handle. Once you have this handle, you can use AddTableField and AddKey to add fields and keys to the table. When you have finished defining fields and keys, you use CreateTable to create the table in C/SIDE.

When the table has been created with CreateTable, you must close the create table handle with CreateTableEnd. If you use CreateTableEnd without using CreateTable first, the table will not be created.



© 2009 Microsoft Corporation. All rights reserved.