Board index » delphi » Allow Zero Length

Allow Zero Length

How can I change the Allow Zero Length property of an Access 97 Table field
?

Thanks in advance,

Ertan

 

Re:Allow Zero Length


You can either use Access or you can do it through DAO. To use DAO, you need
to create variants that will be assigned the DBEngine, WorkSpace, Table and
TableDef objects. Then, find the field in question and set the
AllowZeroLength property to true.

Here's a start:

var
    DBEngine,
    DBWork,
    DBData,
    DBTable,
    DBTableDef,
    DBField: variant;

begin
    try
        DBEngine := CreateOLEObject('DAO.DBEngine.35');
        DBWork := DBEngine.CreateWorkSpace('MySpace','Admin','');
        DBData := DBWork.OpenDatabase('c:\path\file.mdb');
        for x := 0 to DBData.TableDefs.Count - 1 do
            if DBData.TableDefs[x].Name = TableNameNeeded then
                DBTable := DBData.TableDefs[x];
        for x := 0 to DBTable.FieldDefs.Count - 1 do
            if DBTable.FieldDefs[x].Name = FieldToModify then
                DBField := DBTable.FieldDefs[x];
        DBField.AllowZeroLength := true;
        DBWork.CloseDatabase;
    finally
        DBEngine := unassigned;
        ....  set all to unassigned ....
    end;
end;

--

Woody

Quote
Ertan Fidan <efi...@webstar.co.uk> wrote in message

news:76v3h4$cdn9@forums.borland.com...
Quote
>How can I change the Allow Zero Length property of an Access 97 Table field
>?

>Thanks in advance,

>Ertan

Other Threads