Avatar of adraughn
adraughnFlag for United States of America asked on

Loop thru tables / subdatasheet property check

Is it possible to write something that will loop thru all of my existing tables and set the subdatasheet property to none?

someone else is working on the project with me and has made it a habit to create tables without changing this property. i don't want to have to check them all of the time. I know I can use mSysObjects to return all of the table names but am stuck after that.

-a
Microsoft Access

Avatar of undefined
Last Comment
adraughn

8/22/2022 - Mon
omgang

Start with this.  It's a code sample to loop through all existing tables in the db.
https://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_23387790.html

I'll check on the property setting

OM Gang
koutny

ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

And KUDOS for just saying NO to SubDataSheets !!

Might as well throw in this also - just say NO to Zero Length Strings:

Function SSF_TurnOffAllowZeroLenString()
 
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim prp As DAO.Property
    Const conPropName = "AllowZeroLength"
    Const conPropValue = False
 
    For Each tdf In CurrentDb.TableDefs
        If (tdf.Attributes And dbSystemObject) = 0 Then
            Debug.Print tdf.Name
            For Each fld In tdf.Fields
                If fld.Properties(conPropName) Then
                    Debug.Print tdf.Name & "." & fld.Name
                    fld.Properties(conPropName) = False
                End If
            Next
        End If
    Next
       
    Set prp = Nothing
    Set fld = Nothing
    Set tdf = Nothing
    MsgBox "Turn off Allow Zero Length String complete."
   
End Function
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
ASKER
adraughn

joe:

i'm using 2k. bugged out on:
Dim db As DAO.Database

user defined type not defined.

-a
ASKER
adraughn

koutny:
same error as joe's. on this line:

Dim MyDB As DAO.Database
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
adraughn

kudos joe, thanks....
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.