Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i set the Allow zero length property to yes accross all tables in a db

Tables and Relationships

How do i set the Allow zero length property to yes accross all tables in a db

by  Chance1234  Posted    (Edited  )
here you go

Code:
Sub AllowZeroLenghtonAllFields()
Dim db As Database
Dim tbl As TableDef
Dim fld As DAO.Field
Dim ballowzerolength As Boolean

Set db = CurrentDb

ballowzerolength = True

For Each tbl In db.TableDefs
  With tbl
  Debug.Print tbl.Name
    If .Attributes = 0 Then 'only non system tables
        For Each fld In .Fields
        Debug.Print fld.Name
        
            With fld
               If .Type = dbText Or .Type = dbMemo Then
                   If .AllowZeroLength <> ballowzerolength Then
                     .AllowZeroLength = ballowzerolength
                   End If
               End If
            End With
        Next
      End If
   End With
Next
End Sub
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top