MartyConnelly
martyconnelly at shaw.ca
Wed Mar 10 11:18:30 CST 2004
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 > > >--------------------------------- >Do you Yahoo!? >Yahoo! Search - Find what youre looking for faster. > > -- Marty Connelly Victoria, B.C. Canada