MS Access功能VBA,宏 [英] MS access function vba, macro

查看:128
本文介绍了MS Access功能VBA,宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MS Access中进行报告时遇到一个小问题.我在vba中编写了一个函数,并为RunCode(该函数)创建了一个宏.因此,当我执行宏时,它会运行该函数并给我一个消息框.参见图片.

I'm having a small issue while making a report in MS Access. I wrote a function in vba, and created a macro to RunCode (the function). So when I execute the Macro, it runs the function and gives me a message box. See Image..



我对此进行了研究,并尝试将SetWarning关闭,但此消息不断弹出.我该如何摆脱呢?



I've researched this and tried SetWarning OFF but it keeps popping up. How do i get rid of this?

推荐答案

供以后参考,典型的完整"错误处理结构例如像这样:

For future reference, a typical "complete" error handling structure looks e.g. like this:

Sub MySub() 

On Error GoTo MySub_Err

    ' Stuff


MySub_Exit:
    On Error Resume Next
    ' ... Stuff that always needs to run on exit can go here ...

    ' !! This is the important part that prevents the function 
    ' !! from always running into the error handler:
    Exit Sub

MySub_Err:
    MsgBox Err.Description, vbExclamation, "Runtime Error " & Err.Number & " in MySub"
    Resume MySub_Exit

End Sub

MZ工具可以自动创建此结构(但可自定义).

MZ-Tools can create this structure automatically (but customizable).

这篇关于MS Access功能VBA,宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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