?
Solved

Access 'nested' tables?

Posted on 2015-01-14
3
Medium Priority
?
479 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

864 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