Need to edge out the competition for your dream job? Train for certifications today.
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Set dbs = CurrentDb
Dim prp As DAO.Property
Dim fld As DAO.Field
For Each tdf In CurrentDb.TableDefs
If Left(tdf.Name, 4) <> "msys" Then
For Each fld In tdf.Fields
For Each prp In fld.Properties
If prp.Name = "TextAlign" Then
'/ 1=Left, 2=Center, 3=Right
prp.Value = 1
Open in new window
Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.
To do these kinds of things, you take code like what Scott posted and throw in code to set a Boolean to check whether a particular property exists or not.
Whether that default Access sets when it creates textAlign is accessible and/or amenable to alteration is anybody's guess.
On Error Resume Next
Dim db As dao.Database
Dim tdf As dao.TableDef
Dim prp As dao.Property
Const conPropName = "SubdatasheetName"
Const conPropValue = "[None]"
Set db = CurrentDb
For Each tdf In db.TableDefs
If (tdf.Attributes And dbSystemObject) = 0 Then
If tdf.Connect = vbNullString And Asc(tdf.Name) <> 126 Then 'Not attached, or temp.
If tdf.Properties(conPropName) <> conPropValue Then
Set prp = Nothing
Set tdf = Nothing
Set db = Nothing
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.