home *** CD-ROM | disk | FTP | other *** search
- Sub CreateDocument
- ' * RUNTIME DEPENDENCIES
- ' * Files and paths: This script depends on an existing dBASE IV
- ' * database in the directory:
- ' * C:\LOTUS\WORK\APPROACH\BLANK.DBF
-
- ' Declare the necessary variables.
- Dim MyConnection As New Connection ' Connection to a table on disk
- Dim MyQuery As New Query ' Query used to extract data from
- ' the table
- Dim MyResultSet As New ResultSet ' Result set to contain extracted
- ' data in the new document
- Dim MyDoc As Document ' New document object
-
- ' Specify the type of database (dBASE IV) to connect to as the source
- ' for the new document.
- If MyConnection.ConnectTo("dBASE IV") Then
- ' Specify the name of the connection MyConnection that the
- ' query MyQuery uses to create the new document.
- Set MyQuery.Connection = MyConnection
-
- ' Specify the full path and table name to be used as source for
- ' the new document.
- MyQuery.TableName = "C:\LOTUS\WORK\APPROACH\BLANK.DBF"
-
- ' Add a statement to specify a subset of records to be returned
- ' in the result set here. "MyQuery.SQL = ..."
-
- ' Specify the result set in the new database to receive the new
- ' records from the query.
- Set MyResultSet.Query = MyQuery
-
- ' If the connection and query succeed, create the new document.
- If (MyResultSet.Execute)Then
- Set MyDoc = New Document(MyResultSet)
- End If ' If the result set was successful.
- ' Error handling for a failed result set would go here.
-
- ' Disconnect from the source table.
- MyConnection.Disconnect
- End If ' If the connection was successful.
- ' Error handling for a failed connection would go here.
-
- End Sub
-
-