Automating Database

As an example, consider opening a table within a database. The following code would work in a macro inside Write or Spreadsheet (or any application supporting OLE).

Set app = CreateObject("AbilityDatabase.Application")

app.Visible = True

app.Databases.Open "c:\my documents\mydata.mdb", False

Set mydb = app.ActiveDatabase

Set mytb = mydb.Tables.Open("PhilData")

MsgBox mytb.Fields(0).Value

The second line "app.Visible" causes the application to become visible to the user (otherwise the application would run in the background and not be visible). The next three lines open a named database and creates a reference to a specified table in mytb. The last line displays the data from the first field in record 1.