Skip to Content
Access Database Design and Programming, Second Edition
book

Access Database Design and Programming, Second Edition

by Steven Roman PhD
July 1999
Intermediate to advanced
432 pages
13h 10m
English
O'Reilly Media, Inc.
Content preview from Access Database Design and Programming, Second Edition

Creating a Table and Its Fields

Tables are created using the CreateTableDef method of a Database object. The full syntax of this method is:

Set TableDefVar = DatabaseVar.CreateTableDef _
([TableDefName[, attributes[, source[, connect]]]])

where:

  • TableDefName is a string or string variable holding the name of the new TableDef object.

  • For information about the optional parameters, see the Access Help system.

Notes

  • The new TableDef object must be appended to the TableDefs collection using the Append method. However, before appending, the table must have at least one field.

  • CreateTableDef does not check for an already used TableDefName. If TableDefName does refer to an object already in the TableDefs collection, an error will occur when you use the Append method, but not before.

  • To remove a TableDef object from a TableDefs collection, use the Delete method.

Fields are created for a table using the CreateField method of the TableDef object. The syntax is:

Set FieldVar =TableDefVar.CreateField _
([FieldName[, type [, size]]])

where:

  • FieldName is a string or string variable that names the new Field object.

  • type is an integer constant that determines the data type of the new Field object. (See Table 15.1.)

  • size is an integer between 1 and 255 that indicates the maximum size, in bytes, for a text field. This argument is ignored for other types of fields.

Note

To remove a field from a TableDef object, use the Delete method.

Table 15-1. Constants for the Type Property

Data Type

Constant

Numerical ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Access Database Design & Programming, 3rd Edition

Access Database Design & Programming, 3rd Edition

Steven Roman

Publisher Resources

ISBN: 1565926269Catalog PageErrata