Laetitia Clark <la*******@telkomsa.net> wrote in message news:<40**********************@news.newsgroups.ws> ...
Hi All
I have a number of tables which have Text fields. I need to change the
AllowZeroLength property value to True for all of them. Does anyone have
some code which will do this for me ? Thanks.
Laetitia
South Africa
Something like this ought to work... Note, it uses DAO, not ADO.
Option Compare Database
Option Explicit
Public Sub SetZeroLength(ByVal strTable As String, ByVal blnAllow As
Boolean)
'PURPOSE: sets the ZeroLength property of all the fields in a table to
blnAllow (Yes/no)
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim intCounter As Integer
Set db = CurrentDb
Set tdf = db.TableDefs(strTable)
For intCounter = 0 To tdf.Fields.Count - 1
If tdf.Fields(intCounter).Type = dbText Then
tdf.Fields(intCounter).AllowZeroLength = blnAllow
End If
Next intCounter
Set tdf = Nothing
Set db = Nothing
End Sub