Solved

Access 'nested' tables?

Posted on 2015-01-14
3
330 Views
Last Modified: 2015-01-14
Hi,

I am in the process of converting an access database and code to SQL and while copying tables into SQL I stumbled over something weird.

I know access reasonably well, but had not seen this before, please help.

On the enclosed picture there's a table called PO_Total which is a linked table to another access database.  However when I open it there a 'drop-down' + next to each row with more data... where is that coming from, and where is that defined?

Thank you in advance, please ask any questions if this does not make sense...

~J
delete.png
0
Comment
Question by:prosit
3 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 40549913
That is called a "subdatasheet"
Whenever you create explicit one to many relationships between two tables, these drop-downs will appear.
...clicking any of them will expand them and display the "child" records for the selected "Parent" record.

You can turn them off with code like this:
http://www.rogersaccesslibrary.com/forum/set-subdatasheet-to-none-in-all-tables_topic614.html

JeffCoachman
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40549926
This was a  'feature' added to Access
It is a UI feature in the tables--not a place where you usually want UI to be.
When enabled, any table that is the 'one' in a one-to-many relationship will show a subdatasheet for the 'many' side.

This is strictly a UI feature.  If can be ignored if the purpose is to migrate the data away from Access.
If the database file will continue to be used, it can become a performance issue.
Many professional developers will turn this off.
It can be done table by table through the Access UI (although I have forgotten how now)
Or by code.

the VBA code I used to identify tables that had this feature was

Function ReportSubDataSh()
On Error Resume Next
    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 tdf.Properties(conPropName) <> conPropValue Then
                        MsgBox tdf.Name
                    End If
            End If
        End If
    Next
    
    Set prp = Nothing
    Set tdf = Nothing
    Set db = Nothing
End Function

Open in new window


From there it was simple after checking that I wasn't going to hose anything up to change
MsgBox tdf.Name

to
tdf.Properties(conPropName) =  conPropValue

and turn it all off.
0
 
LVL 2

Author Closing Comment

by:prosit
ID: 40549990
Ahh, confusing me while trying to give me more than I asked for ;)

Thanks guys...

~j
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now