Is_Member question

  • Thread starter Thread starter AkAlan via AccessMonster.com
  • Start date Start date
A

AkAlan via AccessMonster.com

I need to know how to pass the current user and a specific role to the
Is_Member function on SQL Server using VBA and then have the true or false
value returned back. I'm trying to determine if a user is a member of Job
Control or not so I can make a command button visible or not. Thanks for any
help.
 
AkAlan via AccessMonster.com said:
I need to know how to pass the current user and a specific role to the
Is_Member function on SQL Server using VBA and then have the true or false
value returned back. I'm trying to determine if a user is a member of Job
Control or not so I can make a command button visible or not. Thanks for any
help.

IS_MEMBER doesn't have a user argument, it assumes the current user, which
is what you want.

Here's my VBA IsMember function:

'Code begins here
Public Function IsMember(ByRef Role As String) As Boolean

Dim rs As ADODB.Recordset

Set rs = New ADODB.Recordset
rs.ActiveConnection = CurrentProject.Connection
rs.Source = "SELECT IS_MEMBER('" & Role & "') AS IsMember"
rs.Open

IsMember = rs!IsMember

rs.Close
Set rs = Nothing

End Function
 
Back
Top