Name

Delete (Parameter Object, Recordset Object) — rsObj .Delete Record(s)ToBeDeleted

Synopsis

Tip

Only the Delete method of the Recordset object is covered here.

The Delete method of the Recordset object allows you to delete either the current record or a group of records. To delete a group of records, you must use the Filter property to define the group of records before deleting them.

Parameters

Record(s)ToBeDeleted

An integer constant that defines whether you want to delete only the current record or all records meeting the criteria set forth in the Recordset.Filter property. The possible values for this parameter are:

adAffectAll

If the Filter property of the Recordset object is not set, then the call to the Delete method affects all records. Otherwise, Delete affects only those records visible after application of the Filter.

adAffectAllChapters

All records are deleted, regardless of the presence of a value in the Filter property.

adAffectCurrent

Only the current record is deleted. This is the default.

adAffectGroup

Removes all the records from the database that meet the criteria in the Filter property. Once deleted, you can set the Filter property to adFilterAffectedRecords to view those records affected by the call to the Delete method.

Example

The following example demonstrates the use of the Delete method to delete a group of records that match the criteria in the Recordset object's current Filter property.

<%@ LANGUAGE="VBSCRIPT" %> <% Response.Buffer = True %> <HTML> <HEAD> ...

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.