Contents

 
Home
ASPRunner Professional 7.1 manual
Prev Page Next Page
 
 

Before deleting a record check if related records exist

 

Before deleting a record in the Orders table check for related items in the OrderDetails table (Sample Northwind database in MS Access).

yellowbulbNote: Change the values listed in red to match your specific needs.

Function BeforeDelete(where,deleted_values)

  ' Parameters:

  ' where - string with WHERE clause pointing to record to be deleted.

  set rstmp = dal.Table("Order_Details").Query("OrderID=" & _

     deleted_values("OrderID"),"")

  if rstmp.eof then

    BeforeDelete = True

  else

    BeforeDelete = False

  response.write "Order " & key &_

  " has related records in Order Details table and cannot be deleted"

  end if

  rstmp.Close : set rstmp = nothing

End Function

For more information about using Data Access Layer (DAL), see Data Access Layer.

Converted from CHM to HTML with chm2web Standard 2.85 (unicode)