Access VBA Programming 

 OpenTable


OpenTable

Opens a table in the current database.

Syntax

 DoCmd.OpenTable  TableName  [,  View  ][,  DataMode  ] 

with the following parameters:

TableName

A String indicating the name of the table in the current database to open .

View

One of the following members of the AcView enumeration: acViewDesign (design view), acViewNormal (datasheet view, the default), and acViewPreview (print preview).

DataMode

A member of the AcOpenDataMode enumeration for tables opened in acNormal view. Possible values are acAdd, acEdit (the default), and acReadOnly.

Example

The example code iterates the AllTables collection, opens each nonsystem table, prints its structure, and then closes the open table.

 Public Sub PrintTableStructures() Dim tbl As Variant For Each tbl In CurrentData.AllTables If InStr(1, tbl.Name, "MSys", vbBinaryCompare) = 0 Then DoCmd.OpenTable tbl.Name, acViewDesign If MsgBox("Print table structure?", _ vbQuestion Or vbYesNoCancel, _ "Print Table Structure") = vbYes Then DoCmd.PrintOut acPrintAll End If DoCmd.Close acTable, tbl.Name, acSaveNo End If Next End Sub 

Comments

You can iterate the tables in the current database by using the CurrentData.AllTables collection. It includes system tables whose names begin with MSys…, however.


 

Authors: Brown C. E. Petrusha R.

ISBN: 1598633937   Current page: 168 from 214

This Manual are presented on flylib.com

Our library present to you materials from book Access VBA Programming.

Warning! The page OpenTable from this book is informational only! Do not print out this page! Do NOT SUBMIT this page as part of your website or work without confirmation from the authors.

You can read the contents of the book, but we strongly recommend that you purchase. or example, you can Buy this book on Amazon.com


  • Authors:
  • Brown C. E.
  • Petrusha R.
  • Keys:
  • opentable
  • opens
  • table
  • current
  • database
  • docmd
  • tablename
  • datamode
  • Buy this book on Amazon.com

if you may any questions - contact us: flylib(at)qtcs.net
Privacy Policy