Link to home
Start Free TrialLog in
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
Avatar of omgang
omgang
Flag of United States of America image

Start with this.  It's a code sample to loop through all existing tables in the db.
https://www.experts-exchange.com/questions/23387790/Modify-Access-2003-tables-programmatically-from-VB6.html

I'll check on the property setting

OM Gang
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Avatar of adraughn

ASKER

joe:

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

user defined type not defined.

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

Dim MyDB As DAO.Database
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
kudos joe, thanks....