[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.
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
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
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
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.