Show/Hide Toolbars

ASPRunnerPro 9.8 Manual

Navigation: Advanced topics > Events > Predefined actions

ASPrunnerPro32x32     ASPRunnerPro manual

Check if specific record exists

Scroll Prev Next More


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


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


    ' 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.


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


  ' if dont exist do something else

   BeforeAdd = true

end if

rsExists.Close : set rsExists = Nothing