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

msgbox的应用

时 间:2007-11-20 16:22:12
作 者:李双军   ID:18  城市:温州
摘 要:msgbox妙用
正 文:

在修改窗体中关闭按钮中加入msgbox提示框可以查看到哪些内容修改了


Private Sub Form_Load()

    Me.RecordSource = "Select * FROM tbl_gys Where tbl_gys.gysID='" & strSelectID & "'"

    strSelectID_old = strSelectID
     Me.gysid.Enabled = False
     Me.gyslbid.SetFocus
Me.bm.Caption = Me.gyslbid     'bm,bm1,bm2,bm3为标签
Me.bm1.Caption = Me.gysmc
If Not IsNull(Me.lxr) Then
Me.bm2.Caption = Me.lxr
End If
If Not IsNull(Me.lxdh) Then

Me.bm3.Caption = Me.lxdh
End If
End Sub

Private Sub ToolbarFrm_ButtonClick(ByVal Button As Object)
'刷新当前窗体内容
Dim a, b, c, d As String
a = ""
b = ""
c = ""
d = ""
    Me.Refresh
If Me.bm.Caption <> Me.gyslbid Then
a = "您确认要修改此供应商类别为【" & Me.gyslbid & "】吗? "
     End If
     If Me.bm1.Caption <> Me.gysmc Then
    b = "您确认要修改此供应商为【" & Me.gysmc & "】吗?"
           End If
           If Me.bm2.Caption <> Me.lxr Then
           c = "您确认要修改此联系人为【" & Me.lxr & "】吗?"
                 End If
                 If Me.bm3.Caption <> Me.lxdh Then
                 d = "您确认要修改此联系电话为【" & Me.lxdh & "】吗?"
End If

If a <> "" or b <> "" or c <> "" or d <> "" Then
 If MsgBox("" & a & Chr(13) & b & Chr(13) & c & Chr(13) & d & "", vbOKCancel + vbInformation, "提示") = vbOK Then
    DoCmd.Echo False
    Forms!usysfrmMain!frmChild.SourceObject = "frm_gys_child"
    DoCmd.Echo True

    Forms!usysfrmMain!frmChild.Form.TimerInterval = 300

    DoCmd.Close acForm, "frm_gys_child_Edit"
   

End If
Exit Sub

End If
Forms!usysfrmMain!frmChild.Form.TimerInterval = 300

    DoCmd.Close acForm, "frm_gys_child_Edit"
End Sub

在msgbox的提示中加入Chr(13)是进行回车,这样就可以显示几行了也可以用Chr(11)换行来代替,

这个效果不错,呵呵,大家可以试一下,再修改一下就可以对修改的内容进行取消恢复了

 



Access软件网官方交流QQ群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

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