Redirecting user to another Url based on a dblookup result

I would like to write a code which allows me to do this. I think it can be done using LotusScript but I am wondering if it can be done using @formula.

I have a form which used a by certain type of users, Unfortunately this forms is part of a large intranet site and cen be accessed by anyone who has logged in. What happens when user open they page is that I performed a Db lookup to check if they have a profile which indicates they are a user of this system. Otherwise what I like to do is to send the user to another Page informing them that they are not authorised to use the form.

I used onload event to perform this and it worked. The only thing I don’t like about it is the fact that the form get’s loaded first then user get redirected - its visually very disturbing. I tried using @Urlopen but its seems it cannot work. Maybe I am wrong. Can anyone suggest what I can do about this?

Regards