Setting the Inital Table Field Property Values

B

BCP

I would like to be able to set the default value for Allow Zero Length to
True.

For the vast majority of cases I do not was this value set to False but that
is the default. I end up having to go through manually and setting the
switch to true for each column. I can not seem to find the switch to set the
default to True so I do not have to do this for all of my tables.

Any help you can give will be greatly appreciated - BCP.
 
D

Douglas J. Steele

AFAIK, there is no switch (and I believe the default actually varies from
version to version!)

However, it's pretty straight-forward to use code to change it:

Sub SetZeroLength()
Dim dbCurr As DAO.Database
Dim tdfCurr As DAO.TableDef
Dim fldCurr As DAO.Field

Set dbCurr = CurrentDb()
For Each tdfCurr In dbCurr.TableDefs
For Each fldCurr In tdfCurr.Fields
If fldCurr.Type = dbText Or _
fldCurr.Type = dbMemo Then
fldCurr.AllowZeroLength = True
End If
Next fldCurr
Next tdfCurr

End Sub
 
Top