Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datablock WHERE clause

Status
Not open for further replies.

jeannie322

Programmer
May 18, 2001
25
US
In the form, I only want the person creating, or approving or the managers to see their own data. So, I put a where clause on the datablock for security within the form. However, my problem is when I try to query on JUST ONE record it still brings me all the records in my set. Any ideas??? -- I am using forms5

WHERE
:)GLOBAL.USERID = mishap_trend.submitted_username) or
-- person submitting record
:)global.userid = mishap_trend.corrective_username) or
-- person approving record
:)GLOBAL.USERID = MISHAP_TREND.USER_NAME)
-- person creating record (i.e a secretary)
OR
(exists
(select mishap_no from csc.mishap_route
where mishap_trend.mishap_no = mishap_route.mishap_no and
route_to = :global.userid))
-- sends out email when routed to, & this will allow that
-- user to see that record if they are in the routing
OR
(EXISTS
(select role_isn from mics.MICS_USER_ROLE
where role_isn = 3272 and user_isn = :global.user_isn))
-- this is a role I have given to the managers

If you need any more info, let me know. I know it has to do with this where clause because I can take it off & it works. Thanks in advance!!!
 
To me, it looks like, if the last condition,
EXISTS
(select role_isn from mics.MICS_USER_ROLE
where role_isn = 3272 and user_isn = :global.user_isn))

is true, then it will stay true for every row in the table you are selecting from. Without seeing the FROM clause, it's hard to say for sure, but that's my guess.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top