Solved

Access 'nested' tables?

Posted on 2015-01-14
3
372 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

680 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