'======================================== Function zSql_Delete(sDsn, sTableName, sIdFieldName, sIdFieldValue) 'This function is for deleting a single entry in a database 'Ideally the field referenced should be the primary key 'The function will abort if nothing is found 'For SAFETY the function will abort if more than one entry is found Dim sSql sSql = "SELECT * FROM " & sTableName & " WHERE " & sIdFieldName & " = " & sIdFieldValue iCount = zSql_CountRows(sDsn,sSql) If iCount = 1 Then sSql = "DELETE FROM " & sTableName & " WHERE " & sIdFieldName & " = " & sIdFieldValue Call SqlExecute(sDsn, sSql) zSql_Delete = True ElseIf iCount = 0 Then print "Nothing found to delete" zSql_Delete = False Else print "More than one row found - aborting delete" zSql_Delete = False End If End Function '========================================