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!

Call a stored procedure using a module

Status
Not open for further replies.

Hfnet

IS-IT--Management
Dec 31, 2003
369
GB
I have a function that returns a true or false value based on two input criteria:

Select dbo.fn_RequestAccessByIDID(1, 5) AS Expr1

What I wish to do is to create a module to call this function, as the values alter per user, so I wish to use (d1, d2) as variables and call the module from my forms coding as needed.

Can someone point me in the right direction as I don't know how to create modules.

Thanks
 
Why do you need to use a select statement? Why can't you just set a variable = fn_RequestAcessByIDID(1,5) on the form_Open event?



Sub form_Open
Dim blnAccess as Boolean
blnAccess = fn_RequestAcessByIDID(1,5)

If blnAccess then
me.close
else
do whatever
end if
exit sub


 
Thanks for that. I have found that I can't put in anything but numbers inside the brackets. The first number is the user id, and the second number is the access level. If the user id has access to the second number then it returns true. What I thought I needed to do is to call a module with variables, so that it would work, therefore in the module it would be

fn_RequestAcessByIDID(d1,d2)

Whereby the d1 would be the user id and d2 would be the access level required to continue, and the module would be called with

If modulename(me.userid, x) then.....


The form is complex with tabs requiring various access levels to do certain tasks, so an onload is not applicable. It may call on different levels for 15 different functions, so a module would (i think) mean less space in the form coding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top