Remove subdatasheet column from a table

V

Vic

Is it possible to remove the subdatasheet column from the table view for tables with existing relationships? The additional column usually has "+" in the field which, I'd like to remove
 
A

Allen Browne

Good move! Subdatasheets can be a performance and security issue.

1. Open each table in design view.
2. Open the Properties box (View menu).
3. Set the Subdatasheet Name to:
[None]
If your database is split, do this on the back end mdb.

Alternatively you can set the property for all tables in your database
programmatically:

Function TurnOffSubDataSh()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim prp As DAO.Property
Const conPropName = "SubdatasheetName"
Const conPropValue = "[None]"

Set db = DBEngine(0)(0)
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 Not HasProperty(tdf, conPropName) Then
Set prp = tdf.CreateProperty(conPropName, dbText,
conPropValue)
tdf.Properties.Append prp
Else
If tdf.Properties(conPropName) <> conPropValue Then
tdf.Properties(conPropName) = conPropValue
End If
End If
End If
End If
Next

Set prp = Nothing
Set tdf = Nothing
Set db = Nothing
End Function

Public Function HasProperty(obj As Object, strPropName As String) As Boolean
'Purpose: Return true if the object has the property.
Dim varDummy As Variant

On Error Resume Next
varDummy = obj.Properties(strPropName)
HasProperty = (Err.Number = 0)
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Vic said:
Is it possible to remove the subdatasheet column from the table view for
tables with existing relationships? The additional column usually has "+" in
the field which, I'd like to remove
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top