[AccessD] Re: Setting/ retrieving Field properties?

Robert L. Stewart rl_stewart at highstream.net
Wed Mar 10 12:25:06 CST 2004


Sander,

Also, remember that a property does not exist until it has
been created for the first time for a column.  For example,
if you have not set the default value property of a column,
the default property does not exist for that column and you
will have to create it before you can set it.

That is why your original code did not show you what you
were expecting.

Robert

At 12:00 PM 3/10/2004 -0600, you wrote:
>Date: Wed, 10 Mar 2004 09:18:30 -0800
>From: MartyConnelly <martyconnelly at shaw.ca>
>Subject: Re: [AccessD] Setting/ retrieving Field properties?
>To: Access Developers discussion and problem solving
>         <accessd at databaseadvisors.com>
>Message-ID: <404F4DE6.2010205 at shaw.ca>
>Content-Type: text/plain; charset=windows-1252; format=flowed
>
>Here is an example that resets all fields in all tables to allow zero
>length, skips around errors with on error resume next
>ACC: How to Set AllowZeroLength Property to Yes in All Tables
>http://support.microsoft.com/default.aspx?scid=kb;en-us;130336&Product=acc
>
>S D wrote:
>
> >Hi group,
> >
> >I need to set the field properties of a lot of tables. I want to do this 
> using VBA.
> >I was reading Access 2000 Developers Handbook and I found the code 
> printed below. However these are not the properties I expected.
> >I need to set field properties like:
> >Fiel Size
> >Required
> >Allow Zerow Length
> >
> >Any idea how I can do this?
> >
> >TIA
> >
> >Sander
> >
> >
> >Private Sub Command0_Click()
> >   Dim db As DAO.Database
> >   Dim intI As Integer
> >   Dim tdf As DAO.TableDef
> >
> >   Set db = CurrentDb()
> >
> >   For intI = 0 To db.TableDefs.Count - 1
> >      Set tdf = db.TableDefs(intI)
> >      If tdf.Name = "V3_44_RSDTD1" Then
> >         Debug.Print "Printing properties for table: " & tdf.Name
> >         Call ListTableProps(tdf.Name)
> >         MsgBox "Properties listed!"
> >      End If
> >   Next intI
> >
> >   MsgBox "Done! Tables found: " & intI
> >
> >End Sub
> >Sub ListTableProps(strTable As String)
> >   Dim db As Database
> >   Dim tdf As TableDef
> >   Dim prp As DAO.Property
> >
> >   Set db = CurrentDb()
> >   Set tdf = db(strTable)
> >
> >   For Each prp In tdf.Properties
> >      Debug.Print prp.Name, prp.Type, prp.Value
> >   Next prp
> >End Sub
> >





More information about the AccessD mailing list