|
请帮忙把这段代码改成一个过程,谢谢~~~里面只有:“详细物料”这一个会改变,别的都是一样。
Dim sql, strDxm As String
Dim con2 As New ADODB.Connection
Dim rcord2 As New ADODB.Recordset
strDxm = "详细物料"
sql = "SELECT 权限.权限, 对象.对象名, 权限.用户名 FROM 权限 INNER JOIN 对象 ON 权限.对象名 = 对象.ID "
sql = sql & " WHERE (((对象.对象名) = """ & strDxm
sql = sql & """ ) And ((权限.用户名) = """ & userCode & """))"
Set con2 = CurrentProject.Connection
rcord2.OPEN sql, con2, adOpenKeyset, adLockPessimistic
Debug.Print rcord2.Fields(0)
Select Case rcord2.Fields(0)
Case 1
DoCmd.OpenForm "详细物料"
Forms.详细物料.Form.AllowEdits = True
Forms.详细物料.Form.AllowAdditions = True
Case 2
DoCmd.OpenForm "详细物料"
Forms.详细物料.Form.AllowEdits = False
Forms.详细物料.Form.AllowAdditions = False
Case 3
DoCmd.OpenForm "详细物料"
Forms.详细物料.Form.AllowEdits = True
Forms.详细物料.Form.AllowAdditions = False
Case Else
MsgBox "无此权限!!"
Exit Sub
End Select |
|