473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Change table property 'subdatasheet name' via code

After learning that the 'subdatasheet name' property set to "[Auto]"
can adversely effect database speed, I wanted to send a small code
snippent to my end users to reset the SubdatasheetName Property so they
don't have to manually cycle through 35 or 40 tables and change the
property. VBA help says: "To set the SubdatasheetName property by using
Visual Basic, you must first either:
-Set the property in table Design view by pointing to Properties on the
View menu.
-Create the property by using the DAO CreateProperty method."

I tried but can't figure out how to do either. Why should I need to
create a property if it already exists? I saved myself some clicks by
running:

Public Sub rmvSubDataSheetName()
Dim db As Database
Dim tbl As TableDef
Dim tdfLoop As TableDef
Dim intContinue As Integer

Set db = CurrentDb()
With db
For Each tbl In .TableDefs
DoCmd.OpenTable tbl.Name, acViewDesign
DoCmd.SelectObject acTable, tbl.Name
DoCmd.RunCommand acCmdProperties
--------THIS IS WHERE I AM STUCK I END UP CLICKING WITH THE MOUSE
Next tbl
End With
End Sub

I want to change the property "subdatasheetname" to "[None]" but I
can't figure out how. Any suggestions?

Thanks.

Aug 24 '06 #1
1 11073
On 24 Aug 2006 14:56:57 -0700, "Jim M" <ma*****@rci.rutgers.eduwrote:
>After learning that the 'subdatasheet name' property set to "[Auto]"
can adversely effect database speed, I wanted to send a small code
snippent to my end users to reset the SubdatasheetName Property so they
don't have to manually cycle through 35 or 40 tables and change the
property. VBA help says: "To set the SubdatasheetName property by using
Visual Basic, you must first either:
-Set the property in table Design view by pointing to Properties on the
View menu.
-Create the property by using the DAO CreateProperty method."

I tried but can't figure out how to do either. Why should I need to
create a property if it already exists? I saved myself some clicks by
running:

Public Sub rmvSubDataSheetName()
Dim db As Database
Dim tbl As TableDef
Dim tdfLoop As TableDef
Dim intContinue As Integer

Set db = CurrentDb()
With db
For Each tbl In .TableDefs
DoCmd.OpenTable tbl.Name, acViewDesign
DoCmd.SelectObject acTable, tbl.Name
DoCmd.RunCommand acCmdProperties
--------THIS IS WHERE I AM STUCK I END UP CLICKING WITH THE MOUSE
Next tbl
End With
End Sub

I want to change the property "subdatasheetname" to "[None]" but I
can't figure out how. Any suggestions?

Thanks.

Not sure where I got this from, but it does the trick.

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 & "."

End Function
Wayne Gillespie
Gosford NSW Australia
Aug 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Brian Andrus | last post by:
Ok. I upgraded to MS Access 2003 recently and now I am having great heartache. In Access 2002, when I opened a table to view the data, there were wonderful little "plus" signs that I could click...
3
by: sparks | last post by:
I was copying fields from one table to another. IF the var name starts with milk I change it to egg and create it in the destination table. It works fine but I want to copy the description as...
2
by: Mark | last post by:
I have a FE/BD 2002 DB on a XP pro platform. I know this is ugly but it works for me...... A text file is produced from our Oracle WMS. (Average 20k records) A command button deletes all records...
6
by: davegb | last post by:
I'm trying to create a self-join table to show the relationship between employee and supervisor. In another thread, I was advised to create a SupervisorID in the employee table, a separate...
6
by: Aaron Smith | last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child tables, I have a column that I added to the DataSet (Not in the DataSource). This column does not need to be stored in the...
2
by: Greg Strong | last post by:
Hello All, Is it possible to change table field lookup properties in code? I've been able to change other field properties in code, however so far no luck with field lookup properties. What...
0
by: ray | last post by:
Hi all, I have seen and tried some code posted here to reset the Subdatasheet property of Tables to NONE. It works fine in DAO, but I am using an ADP. So that means that the code won't work,...
5
by: agarwasa2008 | last post by:
Hi, I have a linked table called tbltest and some bounded forms (which add, update, delete records) that were created using that linked table. For some necessary reasons I had to create another...
6
by: gavy7210 | last post by:
hello i am using struts 1.2,Eclipse Platform Version: 3.4.2,mySql 5.0.1,jdk 1.5.. i have a login form(jsp) in which a user logs in,in case he doesnt enter his username and/or password an error...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.