Contents

 
Home
ASPRunner Professional 9.0 manual
Prev Page Next Page
 
 

Check if specific record exists

 

To check if a specific record exists use Check if a specific record exists action.

step11-1-4

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

'**********  Check if specific record exists  ************

dim rsExists

set rsExists = dal.Table("AnyTable").Query("AnyColumn='AnyValue'","")

if not rsExists.eof then

    ' if record exists do something

else

    ' if dont exist do something else

end if

rsExists.Close : set rsExists = Nothing

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

Example

Let's assume we need to check the uniqueness of the entered SSN number. Use the following code in the Before record added event:

'**********  Check if specific record exists  ************

dim rsExists

set rsExists = dal.Table("Clients").Query("SSN='" & values("SSN")  & "'","")

if not rsExists.eof then

  ' if record exists do something

   message = "SSN " & $values("SSN") & " aleready exists."

   BeforeAdd = false

else

  ' if dont exist do something else

   BeforeAdd = true

end if

rsExists.Close : set rsExists = Nothing

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