<% function AddSubscription(ByRef pobjCon, ByVal pintUserID, ByVal pintMessageID) dim intThreadID, strSQL, blnSubscribes, objRs intThreadID = lookup(pobjCon, "thread", "forumMessages", "ID", pintMessageID) 'check that the message exists if isnumeric(intThreadID) then strSQL = "SELECT TOP 1 thread,userID FROM forumEmailnotifications WHERE userID=" & pintUserID & " AND thread=" & intThreadID set objRs = pobjCon.execute(strSQL) blnSubscribes = not objRs.EOF objRs.close set objRs = nothing if not blnSubscribes then strSQL = "INSERT INTO forumEmailnotifications (userID,thread) VALUES (" & pintUserID & "," & intThreadID & ")" pobjCon.execute(strSQL) AddSubscription = true else AddSubscription = false end if else AddSubscription = false end if end function %>