Connecting Tech Pros Worldwide Help | Site Map

Unable to set subdatasheet to None

karen scheu via AccessMonster.com
Guest
 
Posts: n/a
#1: Nov 13 '05
I am having trouble lately opening my local tables. It is taking a a few
seconds to open the table that has no records in it. I read that there is a
bug with the AutoCorrect feature and so I set that option off in my DB which
is an Access 2002-2003 database, then tried to set the subdatasheet to none,
but every time I get back into it, it goes back to Auto. How can I set it to
none and have it stay. I also tried creating a new MDB and setting the
option first then importing the table and setting the subdatasheet to None
and it still does not save.

Please help. I don't really even know if this will resolve my problem yet.

Thanks.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200509/1
Barry Edmund Wright
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Unable to set subdatasheet to None


Karen,
The code below will iterate through all your tables and turn the [auto] to
none. I believe I got the code from Allan Brown's site.
Maybe this will help you.
Regards,
Barry

Public Function TurnOffSubDataSh()

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim prp As DAO.Property
Dim vCnt As Long
Const conPropName = "SubdatasheetName"
Const conPropValue = "[None]"

vStarted = Timer
HourGlass_On

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
vCnt = vCnt + 1
Next tdf

Set prp = Nothing
Set tdf = Nothing
Set db = Nothing

vFinished = Timer
HourGlass_Off

MsgBox "Procedure Complete! " & vCnt, vbInformation, "Time: " &
Format((vFinished - vStarted), "fixed") & " Seconds"

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



"karen scheu via AccessMonster.com" <forum@AccessMonster.com> wrote in
message news:544F5C4941386@AccessMonster.com...
I am having trouble lately opening my local tables. It is taking a a few
seconds to open the table that has no records in it. I read that there is a
bug with the AutoCorrect feature and so I set that option off in my DB which
is an Access 2002-2003 database, then tried to set the subdatasheet to none,
but every time I get back into it, it goes back to Auto. How can I set it
to
none and have it stay. I also tried creating a new MDB and setting the
option first then importing the table and setting the subdatasheet to None
and it still does not save.

Please help. I don't really even know if this will resolve my problem yet.

Thanks.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200509/1


karen scheu via AccessMonster.com
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Unable to set subdatasheet to None


Thank you so much for this code.

Regards,
Karen

Barry Edmund Wright wrote:[color=blue]
>Karen,
>The code below will iterate through all your tables and turn the [auto] to
>none. I believe I got the code from Allan Brown's site.
>Maybe this will help you.
>Regards,
>Barry
>
>Public Function TurnOffSubDataSh()
>
> Dim db As DAO.Database
> Dim tdf As DAO.TableDef
> Dim prp As DAO.Property
> Dim vCnt As Long
> Const conPropName = "SubdatasheetName"
> Const conPropValue = "[None]"
>
> vStarted = Timer
> HourGlass_On
>
> 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
> vCnt = vCnt + 1
> Next tdf
>
> Set prp = Nothing
> Set tdf = Nothing
> Set db = Nothing
>
> vFinished = Timer
> HourGlass_Off
>
> MsgBox "Procedure Complete! " & vCnt, vbInformation, "Time: " &
>Format((vFinished - vStarted), "fixed") & " Seconds"
>
>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
>
>I am having trouble lately opening my local tables. It is taking a a few
>seconds to open the table that has no records in it. I read that there is a
>bug with the AutoCorrect feature and so I set that option off in my DB which
>is an Access 2002-2003 database, then tried to set the subdatasheet to none,
>but every time I get back into it, it goes back to Auto. How can I set it
>to
>none and have it stay. I also tried creating a new MDB and setting the
>option first then importing the table and setting the subdatasheet to None
>and it still does not save.
>
>Please help. I don't really even know if this will resolve my problem yet.
>
>Thanks.[/color]


--
Message posted via http://www.accessmonster.com
Closed Thread