vb123.com

Garry Robinson's Popular MS Access, Office and VB Resource Site

 

Home  Contact Us
Order our Software


 Smart Access  
The Magazine that Access Developers loved to read and write for is back
Article Index Here or Read More

See 2010 Specials

RSS & Newsletter  
Join our XML/RSS Newsfeed or sign up for our informative newsletter on Office Automation, Access and VB topics
Read More

Get Good Help
If you need help with a database, our Professionals could be the answer
Read More

  The Workbench  Find out who has your database open, start the correct version of Access, easy compacting and backups, change startup options, mde compile,  shutdown database Read and Download

Access >>> SQL 
Upsize to SQL Server 2005 or 2008, easily repeated conversions, highly accurate SQL query
translation and web form conversion.
Read More

 Is Your Database Corrupt ?
If you have a corrupt database, Try our Access Recovery service

The Toolbox
Libraries of software that we regularly import into our projects. This is a newer version of the Toolshed More..

SharePoint
For our company file sharing and task management, we use
SharePointHosting


Datamining/Graphs

Explore your data with this versatile graphing and data mining shareware tool.  Read More

DryToast 
Backup and query your BaseCamp
® projects
Read More

Garry's Blog
Find out a few other things that Garry has been writing about Microsoft Access. Read more

Like FMS Products?
Purchase them from us and get a free Workbench or Toolbox  More

About The Editor Garry Robinson writes for a number of popular computer magazines, is now a book author and has worked on 100+ Access databases. He is based in Sydney, Australia
Contact Us ...

Search ...

or try our new site built with SharePoint Designer
 vb123.com.au
 

 

Next Tip     SubDatasheets In Access 2000+

Sub datasheets are one of the good end user improvements of Access 2000.   By understanding them, you can add a lot of functionality to your application.  If you open your tables in read-only mode from a command button, you can add a powerful user exploration tool easily to your application.  As shown below in figure 1, you can find out detail by drilling down on the tables.

In a subdatasheet, you can view and edit related or joined data in a table, query. In the example below,  the suburb table has a one-to-many relationship with the Location table and their are many Tasks for each location.  The diagram shows a drilldown on the tables using sub-datasheets

Figure 1 - Drilling down with subdatasheets

Ways to use a subdatasheet

Access automatically creates a subdatasheet in a table that is in a one-to-one relationship, or is on the "one" side of a one-to-many relationship, when the SubdatasheetName property of the table is set to Auto. A relationship is defined by matching primary key and foreign key fields in the related tables. 

However, you can add a subdatasheet to any table, query, or form. A subdatasheet can have as its source object a table or query (specified in the SubdatasheetName property). 

Table and query subdatasheets

Both a table and a query in Datasheet view can contain either a table or query subdatasheet. If a table has a one-to-many relationship with more than one other table, you can choose which table to add as a subdatasheet by clicking the expand indicator icon (+) and selecting a table in the Insert Subdatasheet dialog box.

By default, Access does not display the foreign key or matching field(s) in the subdatasheet. You can temporarily show the foreign key or matching field(s) by using the Unhide Columns command (Format menu), but the next time you open the datasheet containing the subdatasheet, the column(s) will be hidden again. Hiding or showing these fields changes only the appearance of the subdatasheet; it does not modify any relationship or source object.

Inserting Your Own Sub-Data Sheet

You can add a subdatasheet to a table or query in Datasheet view, or modify a subdatasheet, by using the Subdatasheet command (Insert menu). You specify the matching fields between the datasheet and subdatasheet in the List Child Fields and Link Master Fields boxes in the Insert Subdatasheet dialog box. These boxes correspond to the LinkChildFields and LinkMasterFields properties of the table or query containing the subdatasheet. If you leave these boxes blank, Access displays all rows of the subdatasheet under every row in the datasheet, not just the rows in the subdatasheet that match.

Nesting subdatasheets

You can nest (up to eight levels) a subdatasheet within a subdatasheet. However, each datasheet or subdatasheet can have only one nested subdatasheet. For example, in the Northwind sample database, the Customers table can contain one Orders table subdatasheet, and the Orders table subdatasheet can contain one Orders Details subdatasheet. But the Customers table can't contain both an Orders table subdatasheet and a Salespeople query subdatasheet.

Click on the Next Tip button for the next tips page.

Other Related pages at vb123 are

Exploring Your Data With Subdatasheets for Advanced Users
Consolidation Queries

Data Mining Using MS Access

Linked Tables

Using Access Filters to Graph and Explore Your Databases

"Read a charting in Access 2007 article  in The Toolbox"

 

External Links

A question from Garry to Luke Chung at FMS

When you mention sub-datasheets as being bad for performance, does this apply to a form that opens a table that has a subdatasheet or only when you open the table itself. (same for queries)

I guess that question extends to recordsets.

Hi Garry,

Good to hear from you. Glad to know someone's reading my stuff.

What we've found is that there's a hit for opening a table with the sub-datasheet whether it's directly as a table or in a form (datasheet or form view). Apparently, Access not only opens that table but also the subdatasheet table and links the records, so it's more work whether the user wants it or not.

I haven't seen it impact invisible things like recordsets.

Luke

Links >>>  Home | Search | Workbench | Orders | Newsletter | Access Security | Access professionals