G
gsnidow via AccessMonster.com
Greetings folks. I am using ADP to connect to SQL Server 2000. I am trying
to use the servers PERMISSIONS() function to restrict who can open what form
rather than have them open the form and get a server error message about you
do not have permission. I need somehow to capture the recordset value. In
this case it will be 32. Any ideas?
Private Sub cmdGrowth_Click()
On Error GoTo err_cmdGrowth_Click
Dim cn As ADODB.Connection
Dim rsPermission As ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT PERMISSIONS(OBJECT_ID('spGROWTH_TRACKING')) & 32 "
Set rsPermission = New ADODB.Recordset
Set cn = Application.CurrentProject.Connection
rsPermission.Open strSQL, cn, adOpenForwardOnly, adLockOptimistic
If rsPermission.ActiveConnection = 32 Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmGrowthTrackingPopup"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox "You do not have permission", vbOKOnly
End If
exit_cmdGrowth_Click:
Exit Sub
err_cmdGrowth_Click:
MsgBox Err.Description
Resume exit_cmdGrowth_Click
End Sub
to use the servers PERMISSIONS() function to restrict who can open what form
rather than have them open the form and get a server error message about you
do not have permission. I need somehow to capture the recordset value. In
this case it will be 32. Any ideas?
Private Sub cmdGrowth_Click()
On Error GoTo err_cmdGrowth_Click
Dim cn As ADODB.Connection
Dim rsPermission As ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT PERMISSIONS(OBJECT_ID('spGROWTH_TRACKING')) & 32 "
Set rsPermission = New ADODB.Recordset
Set cn = Application.CurrentProject.Connection
rsPermission.Open strSQL, cn, adOpenForwardOnly, adLockOptimistic
If rsPermission.ActiveConnection = 32 Then
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmGrowthTrackingPopup"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox "You do not have permission", vbOKOnly
End If
exit_cmdGrowth_Click:
Exit Sub
err_cmdGrowth_Click:
MsgBox Err.Description
Resume exit_cmdGrowth_Click
End Sub