in
Forums
Blogs
DevExpress.com
Client Center
Support Center
DevExpress Channel

Paul Kimmel's Blog

Document MS Access Table Schemas

There are a lot of little things one has to do to complete any project. Exporting files, tweaking data, documenting things, coming up with graphics are just some of the skills developers need. Technical books projects are a lot like software projects. There are a little of extra little computer skills, sometimes basic but useful, that have to be managed to get a finished product. One of the samples in the book project—Professional DevExpress ASP.NET Controls—uses an Access database. It was useful to describe the schema of the Access for the Access tables because they were to mapped to another implicit schema. The odd challenge was that there didn’t seem to be an analog for querying the schema of Access tables in Access. You can show hidden objects and query tables like MSysAccessObjects, which will give you some information, but it doesn’t appear that you can query schema tables like you can in SQL Server. (Perhaps one of you knows how to do this and can enlighten me.)

You can of course write code to load a table and dump table and field names, data types, and sizes, and you can use the tools in MS Access to create schema reports. The following numbered steps describe how to create a report for the Cars and CarScheduling tables in Developer Express’ CarsDB.mdb database. You can of course substitute any Access database and tables, if you’d like. To print database documentation follow these steps:

  1. Open MS Access and open your database. (For this sample the CarsDB.MDB sample database installed with ASPxperience was used)
  2. Press ALT+T+Y+D to open the Documentor. (This is a legacy menu option that still works as long as you know the shortcut)
  3. Click the Table tabs
  4. In the Documentor Table tab check the Cars and CarScheduling tables (see Figure 1)
  5. Click the Options button
  6. In the Include for Table group check Properties only
  7. In the Include for Fields group select the Names, Data Types, and Sizes radio button
  8. In the Include for Indexes group select the Nothing radio button (see Figure 2).
  9. Click OK to close the Print Table Definition dialog
  10. Click OK to generate the documentation
  11. When the documentation report is finished the Print Preview tab will be displayed. Click Text File in the Data section to export the report to a text file
  12. In the Export – Text File dialog (see Figure 3)
  13. Check open the destination file after the export operation is complete
  14. Click OK
  15. For the encoding choose Windows default

The export documentation is provided in Listing 1. That’s all there is to it.

image
Figure 1: The Documentor in MS Access.

image
Figure 2: The Print Table Definitions dialog lets you choose what you want to print. 

image
Figure 3: Export the printed result to a text file and open the results.

Listing 1: The exported text content based on the options selected.

C:\Websites\SchedulerDemo\App_Data\CarsDB.mdb                                          Friday, July 03, 2009

Table: Cars                                                                                          Page: 1

Properties

DateCreated:              7/16/2002 5:48:37 PM        DefaultView:              2

GUID:                     {guid {8EECDB13-            LastUpdated:              7/4/2006 12:02:46 PM

                          A77D-45D5-84D5-

NameMap:                  Long binary data            OrderByOn:                False

Orientation:              Left-to-Right               RecordCount:              15

Updatable:                True

Columns

         Name                                                  Type                        Size

         ID                                                    Long Integer                             4

         Trademark                                             Text                                    50

         Model                                                 Text                                    50

         HP                                                    Integer                                  2

         Liter                                                 Double                                   8

         Cyl                                                   Byte                                     1

         TransmissSpeedCount                                   Byte                                     1

         TransmissAutomatic                                    Text                                     3

         MPG_City                                              Byte                                     1

         MPG_Highway                                           Byte                                     1

         Category                                              Text                                     7

         Description                                           Memo                                     -

         Hyperlink                                             Text                                    50

         Picture                                               OLE Object                               -

         Price                                                 Currency                                 8

         RtfContent                                            Memo                                     -

C:\Websites\SchedulerDemo\App_Data\CarsDB.mdb                                          Friday, July 03, 2009

Table: CarScheduling                                                                                 Page: 2

Properties

DateCreated:              7/15/2005 5:09:08 PM        DefaultView:              2

GUID:                     {guid {26F80294-9FDD-       LastUpdated:              11/1/2007 1:31:56 PM

                          4A29-8A9C-

NameMap:                  Long binary data            OrderByOn:                True

Orientation:              Left-to-Right               RecordCount:              20

RowHeight:                1425                        Updatable:                True

Columns

         Name                                                  Type                        Size

         ID                                                    Long Integer                             4

         CarId                                                 Long Integer                             4

         UserId                                                Long Integer                             4

         Status                                                Long Integer                             4

         Subject                                               Text                                    50

         Description                                           Memo                                     -

         Label                                                 Long Integer                             4

         StartTime                                             Date/Time                                8

         EndTime                                               Date/Time                                8

         Location                                              Text                                    50

         AllDay                                                Yes/No                                   1

         EventType                                             Long Integer                             4

         RecurrenceInfo                                        Memo                                     -

         ReminderInfo                                          Memo                                     -

         Price                                                 Currency                                 8

         ContactInfo                                           Memo                                     -

Published Jul 03 2009, 08:40 AM by Paul Kimmel (Developer Express)

Comments

 

Peter Thorpe said:

I haven't checked this out but does Microsoft Visio not support importing a schema from MS access. I know you can certainly do it for SQL server.

I would think that would be a great option to reverse engineer database diagrams and schema info.

July 3, 2009 6:13 AM
 

Renaud Bompuis said:

For a programmatic solution, you may want to have a look at this:

stackoverflow.com/.../how-to-extract-the-schema-of-an-access-mdb-database

Some use VBA, some .Net.

July 5, 2009 10:44 PM
 

James Foye said:

You can use Visio to diagram the schema, using ODBC to connect to the Access database, as well as similar tools, like Enterprise Architect.

For the kind of report shown here, I used to use a great third party tool that would document absolutely everything about an Access database, and would even do some primitive code analysis. But, I forget the name now. They may not be in business anymore.

July 6, 2009 12:13 PM
 

Keith Survell said:

The "Database Documenter" option is not hidden - in fact it's on the "Database Tools" tab in Access 2007, in the "Analyze" group. So there's no need to know/remember the keyboard shortcut.

July 10, 2009 4:16 PM
 

S said:

Excellent article...

January 30, 2010 6:25 PM

Leave a Comment

(required)  
(optional)
(required)  
Verification code: Required
   
Add
Copyright © 1998-2010 Developer Express Inc.
ALL RIGHTS RESERVED