On 10 Oct 2006 21:13:12 -0700,
ra*@aic.net.au wrote:
>I am at the moment manually setting Subdatasheet to [None] in all the
tables in this adp.
If anybody can put me out of my misery by suggesting some automated way
to do it, I would be most grateful. I can't work out how to get ADO or
the ADOX catalog to do it, and DAO doesn't connect to projects. I am
now up to table 75 out of 425 in Systest, and I will have to do it
again in UAT and Prod. Ewwwww. This is the thirty-eighth most boring
thing I have ever had to do, and I very luckily slept through the first
thirty seven.
Ray
Function TurnOffSubDataSheets()
Dim MyDB As DAO.Database
Dim MyProperty As DAO.Property
Dim propName As String
Dim propType As Integer
Dim propVal As String
Dim strS As String
Set MyDB = CurrentDb
propName = "SubDataSheetName"
propType = 10
propVal = "[NONE]"
On Error Resume Next
For I = 0 To MyDB.TableDefs.Count - 1
If (MyDB.TableDefs(I).Attributes And dbSystemObject) = 0 Then
If MyDB.TableDefs(I).Properties(propName).Value <propVal Then
MyDB.TableDefs(I).Properties(propName).Value = propVal
intChangedTables = intChangedTables + 1
End If
If Err.Number = 3270 Then
Set MyProperty = MyDB.TableDefs(I).CreateProperty(propName)
MyProperty.Type = propType
MyProperty.Value = propVal
MyDB.TableDefs(I).Properties.Append MyProperty
Else
If Err.Number <0 Then
MsgBox "Error: " & Err.Number & " on Table " _
& MyDB.TableDefs(I).Name & "."
MyDB.Close
Exit Function
End If
End If
End If
Next I
MsgBox "The " & propName & _
" value for all non-system tables has been updated to " & propVal & "."
MyDB.Close
End Function
Wayne Gillespie
Gosford NSW Australia