Is_Member question

  • Thread starter AkAlan via AccessMonster.com
  • 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.
 
B

Baz

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top