First of all...
Which type is your agencyid? Do you need the extra ' signs?
Moreover the SELECT statement could look a bit different; e.g. you could use the COUNT function to count the rows matching the condition, and then check to see if this number is above 0.
It is something like...
Code:
SELECT COUNT(*) AS agencyCount FROM authusers_reg WHERE agencyid = [someID]
... and then you should be able to retrieve the value something like this...
Code:
rscheck("agencyCount")
You might have to remember that you should do some conversion, if you are comparing the value to some integer. The code you posted will not work as far as I know.
Hope it helps.
Jacob.