Previous Topic

Next Topic

Inhoudsopgave

Book Index

CreateUpdateQuery Object

Function Function CreateUpdateQuery( TableName: String, SPAlias: String ): UpdateQuery_Object

Description

Creates an UpdateQuery object.

Remarks

Use the UpdateQuery object to read and write data. The UpdateQuery object allows full access to the database. The UpdateQuery object is derived from the Query object and can therefore do everything that the Query can do.

Note

The LastUpdatedOn and LastUpdatedBy columns must be included in the result set. The SQL statement must be specified for the update query using the SQL property, for example:

Query.sql = "select Partcode from part"

Parameters

Result

Returns an UpdateQuery object.

Properties, Procedures and Functions

The UpdateQuery object has all the Properties, Procedures and Functions of the Query object. This object also has the following additional properties, procedures and functions:

Function Procedure Insert

Function Procedure Cancel

Function Procedure Edit

Function Procedure Post

Function Procedure Delete

Function Procedure CancelUpdates

Example

Sub Main()

Dim Query

Dim SQL

' Create an SQL statement

SQL = "Select ScriptListCode, Description, LastUpdatedOn "

SQL = SQL & "From ScriptList Where ScriptListCode = 'TEST'"

Set Query = Application.DataBase.CreateUpdateQuery( "ScriptList" ,"ScriptList" )

Query.SQL = SQL

Query.Open

' Check if there is a script with the code Test?

If not Query.EOF then

Query.Edit

Query("Description").Value = "Test Test"

Query.Post

End IF

Query.Close

End Sub