By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

Help - Table Field Properties

P: n/a
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
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.