In a new A2000 mdb, I've added MS's code to turn off SubDataSheets.
However, the On Error statement is not executed, and Access just throws its default error message.
Anyone have any suggestions pls?
MTIA
Max Hugen
Australia
However, the On Error statement is not executed, and Access just throws its default error message.
Code:
Function TurnOffSubDataSheets()
'
' See [URL unfurl="true"]http://support.microsoft.com/Default.aspx?kbid=261000[/URL]
' "BUG: Slower performance on linked tables in Access 2000"
'
On Error GoTo tagError
Dim MyDB As DAO.Database
Dim MyProperty As DAO.Property
Dim propName As String, propVal As String, rplpropValue As String
Dim propType As Integer, i%
Dim intCount As Integer
Set MyDB = CurrentDb
propName = "SubDataSheetName"
propType = 10
propVal = "[None]"
rplpropValue = "[Auto]"
intCount = 0
For i = 0 To MyDB.TableDefs.Count - 1
If (MyDB.TableDefs(i).Attributes And dbSystemObject) = 0 Then
If MyDB.TableDefs(i).Properties(propName).Value = rplpropValue Then
MyDB.TableDefs(i).Properties(propName).Value = propVal
intCount = intCount + 1
End If
End If
tagFromErrorHandling:
Next i
MyDB.Close
If intCount > 0 Then
MsgBox "The " & propName & " value for " & intCount & " non-system tables has been updated to " & propVal & "."
End If
Exit Function
tagError:
If Err.Number = 3270 Then
Set MyProperty = MyDB.TableDefs(i).CreateProperty(propName)
MyProperty.Type = propType
MyProperty.Value = propVal
MyDB.TableDefs(i).Properties.Append MyProperty
intCount = intCount + 1
Resume tagFromErrorHandling
Else
MsgBox Err.Description & vbCrLf & vbCrLf & " in TurnOffSubDataSheets routine."
End If
End Function
Anyone have any suggestions pls?
MTIA
Max Hugen
Australia