Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > Access开发平台

关于Access快速开发平台审核权限的代码优化

时 间:2020-01-22 09:53:27
作 者:Victor Duane   ID:70  城市:闵行
摘 要:优化了审核权限与撤消审核权限按钮代码,集成权限管理。
正 文:

Private Sub btnAudit_Click()
    UpdData Me.btnAudit
    Call CurrentPermissions
End Sub

Private Sub btnUndoAudit_Click()
    UpdData Me.btnUndoAudit
    Call CurrentPermissions
End Sub

Private Sub Form_Load()
    ApplyTheme Me
    LoadLocalLanguage Me
    
    If Nz(Me.OpenArgs) <> "" Then
        LoadRecord Me, "Select * FROM [tbl考勤账套设置] Where [ID]=" & Nz(Me.OpenArgs, 0)
    End If

    If Me.DataEntry Then
        Me![ID] = Null
        Me.Creator = myNickName
    End If
'    Me.btnSave.Enabled = Me.AllowEdits
    Call CurrentPermissions
End Sub


Public Sub CurrentPermissions()
    Me.btnAudit.Enabled = False
    Me.btnUndoAudit.Enabled = False
    Me.btnSave.Enabled = Me.AllowEdits
    
    If Nz(Me.OpenArgs) <> "" Then
        If Me.关账 Then
            EnableButton Me.btnUndoAudit, HasPermission("考勤账套设置", "Undo Audit")
            Me.btnSave.Enabled = False
        Else
            EnableButton Me.btnAudit, HasPermission("考勤账套设置", "Audit")
        End If
    End If
    
End Sub
Public Sub UpdData(ctl As Control)
    Dim UpdDataFlag As Boolean
    Dim strSQL As String
    Dim strMsg As String
    
    Dim blnBook As Boolean
    Dim dtmLastSaveTime As Date
    Dim strLastSaveBy As String
    
    UpdDataFlag = ctl.Enabled
    
    dtmLastSaveTime = Now
    strLastSaveBy = myNickName
    
    If ctl.Name = "btnAudit" Then
        blnBook = True
        strMsg = "该期间的考勤数据即将通过审核," & vbCrLf _
                & "通过审核后,当期考勤数据将不能修改," & vbCrLf _
                & "是否通过审核?"
    ElseIf ctl.Name = "btnUndoAudit" Then
        blnBook = False
        strMsg = "该期间的考勤数据即将撤消审核," & vbCrLf _
                & "撤消审核后,当期考勤数据将可以修改," & vbCrLf _
                & "是否撤消审核?"
    End If
    
    strSQL = "Update tbl考勤账套设置 " _
        & " SET 关账 = " & blnBook & ", LastSaveTime =#" & dtmLastSaveTime & "# , LastSaveBy = '" & myNickName & "'" _
        & " Where [ID]=" & Nz(Me![ID], 0)
        
    If UpdDataFlag Then
        If MsgBox(strMsg, vbOKCancel + vbInformation, "提示") = vbOK Then
            CurrentDb.Execute strSQL
            MsgBox "数据修改成功!", vbOKOnly + vbInformation, "提示"
            Me.关账 = blnBook
            Me.LastSaveBy = strLastSaveBy
            Me.LastSaveTime = dtmLastSaveTime
        End If
    End If
    
End Sub




Access快速开发平台QQ群 (群号:321554481)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助