我在 MS Access 中制作报告时遇到一个小问题。我用 vba 编写了一个函数,并为 RunCode (函数)创建了一个宏。因此,当我执行宏时,它会运行该函数并给我一个消息框。看图片..
I've researched this and tried SetWarning OFF but it keeps popping up. How do i get rid of 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