P
(PeteCresswell)
To remove subdatasheets, I've been using this code:
----------------------------------------------
Public Sub SubDataSheetZap()
Dim thisDB As DAO.Database
Dim curTD As DAO.TableDef
Dim newProp As DAO.Property
Dim i As Long
Const myNone = "[None]"
Const newPropName = "SubDataSheetname"
Set thisDB = CurrentDb()
SysCmd acSysCmdInitMeter, "Zapping SubDataSheet Names...",
thisDB.TableDefs.Count
For i = 0 To thisDB.TableDefs.Count - 1
Set curTD = thisDB.TableDefs(i)
If tablePropExist(newPropName, curTD) Then
curTD.Properties(newPropName) = myNone
Else
Set newProp = curTD.CreateProperty(newPropName, dbText, myNone)
curTD.Properties.Append newProp
Set newProp = Nothing
End If
SysCmd acSysCmdUpdateMeter, i
Next i
SysCmd acSysCmdRemoveMeter
Set curTD = Nothing
Set newProp = Nothing
End Sub
----------------------------------------------
Seems to me like it always worked in MS Access versions prior to 2003.
But under 2003, it seems spotty. Sometimes I'd swear that I ran the code,
checked the table, found it had the subdatasheets removed... and then at some
later date found subdatasheets back in the table.
Does this sound possible?
----------------------------------------------
Public Sub SubDataSheetZap()
Dim thisDB As DAO.Database
Dim curTD As DAO.TableDef
Dim newProp As DAO.Property
Dim i As Long
Const myNone = "[None]"
Const newPropName = "SubDataSheetname"
Set thisDB = CurrentDb()
SysCmd acSysCmdInitMeter, "Zapping SubDataSheet Names...",
thisDB.TableDefs.Count
For i = 0 To thisDB.TableDefs.Count - 1
Set curTD = thisDB.TableDefs(i)
If tablePropExist(newPropName, curTD) Then
curTD.Properties(newPropName) = myNone
Else
Set newProp = curTD.CreateProperty(newPropName, dbText, myNone)
curTD.Properties.Append newProp
Set newProp = Nothing
End If
SysCmd acSysCmdUpdateMeter, i
Next i
SysCmd acSysCmdRemoveMeter
Set curTD = Nothing
Set newProp = Nothing
End Sub
----------------------------------------------
Seems to me like it always worked in MS Access versions prior to 2003.
But under 2003, it seems spotty. Sometimes I'd swear that I ran the code,
checked the table, found it had the subdatasheets removed... and then at some
later date found subdatasheets back in the table.
Does this sound possible?