Personal tools
You are here: Home MS-Access tips Turn sub datasheets of forms off
Document Actions

Turn sub datasheets of forms off

by erny last modified 2006-01-25 18:46

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 Dim I, intChangedTables

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

« December 2008 »
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
 

Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: