增加的消息框,字体大小在Microsoft Access 2013 [英] Increase the font size of message box in Microsoft Access 2013

查看:422
本文介绍了增加的消息框,字体大小在Microsoft Access 2013的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能通过VBA code,以提高访问2013的消息框中的字体大小?

Is it possible to increase the font size of message box in Access 2013 via vba code?

在此

有些用户是40岁以上。它们需要字体的更大尺寸以供查看。谢谢!

Some users are over 40 years old. They require a bigger size of font for viewing. Thanks!

推荐答案

系统错误框的字体大小是一个系统的控制,将需要所有的个人计算机上进行更改。

The font size of system error boxes is a system control and would need to be changed on all individual computers.

您可以改为陷阱VBA中的误差,并通过用户窗体,这将允许您控制消息和字体来显示自己的消息。

You could instead trap the error in VBA and display your own messages via a UserForm, which would allow you to control the message and the font.

所以,而不是

If countDuplicate > 0 Then
    MsgBox _
        "A record of this Part ID already exist. No changes can be made.", _
        vbCritical, _
        "Duplicated Record"
    Me.Undo
End If

您将有以下内容:

If countDuplicate > 0 Then
    frm_AlreadyExists.Show
    Me.Undo
End If

其中, frm_AlreadyExists 是,您将创建并会让你上面列出的消息的形式。

Where frm_AlreadyExists is a form that you would create and would have the message you listed above.

这应该让你开始。为进一步,而不是有一个单独的用户窗体的每个错误,您可以创建将包含一个错误的表错误ID 错误信息错误类型错误标题列。

That should get you started. As a further step, instead of having a separate UserForm for each error, you could create an error table that would contain Error ID, Error Message, Error Type, Error Title columns.

Error ID    Error Message                 Error Type    Error Title         Button Action   Button Text
1           A record ... already exist.   Critical      Duplicated Record   SubName1        Click Here
2           ... not a valid EMPLOYEE      Critical      Invalid GID         SubName2        Click Here

然后你会调用用户窗体为以下内容:

If countDuplicate > 0 Then
    ErrorID = 1 'You'll need to declare this variable elsewhere in your code
    frm_AlreadyExists.Show
End If

而code初始化用户窗体(在用户窗体code模块)

And the code to initialize the UserForm (in the UserForm code module)

Private Sub UserForm_Initialize()
    Dim lErrorID        As Long
    Dim sErrorMessage   As String
    Dim sErrorType      As String
    Dim sErrorTitle     As String
    Dim sBtnText        As String

    lErrorID = errorID

''Look up the following from the Error Table
    'sErrorMessage = Result from lookup
    'sErrorType = Result from lookup
    'sErrorTitle = Result from lookup
    'sBtnText = Result from lookup

    Me.lbl_ErrorMessage = sErrorMessage
    Me.img_ErrorType.Picture = "C:/File Location/" & sErrorType & ".jpg"
    Me.Caption = sErrorTitle
    Me.btn_Action.Caption = sBtnText
End Sub

而$ C $下按钮,点击

And the code for the button click

Private Sub btn_Action_Click()
    Dim sBtnAction      As String

''Look up the following from the Error Table
    'sBtnAction = Result from lookup

    Application.Run sBtnAction

End Sub

通过这一点,一些调整和code搞乱,你现在可以有一个自定义的错误/信息系统,该系统将允许你(甚至用户)来设置字体为消息。

With this and some tweaking and messing with code, you can now have a custom error/message system that would allow you (or even the user) to set the font for the messages.

这篇关于增加的消息框,字体大小在Microsoft Access 2013的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆