高级 Access 编程与应用优化全解析
1. 错误处理库与代码库的创建及使用
在开发过程中,错误处理是至关重要的一环。我们可以创建一个错误处理库,以下是一个示例代码,用于构建错误消息字符串并显示给用户:
'build the error message string from the parameters passed in
strMessage = "An error has occurred in the application."
strMessage = strMessage & vbCrLf & "Error Number: " & lngErrNumber
strMessage = strMessage & vbCrLf & "Error Description: " & strErrDesc
strMessage = strMessage & vbCrLf & "Module Source: " & strModuleSource
strMessage = strMessage & vbCrLf & "Procedure Source: " & strProcedureSource
'display the message to the user
MsgBox strMessage, vbCritical
End Sub
创建并保存新过程后,关闭错误处理库数据库,然后回到另一个数据库添加对该错误处理库的引用。接着添加 TestLibrary 过程来使用库中的
超级会员免费看
订阅专栏 解锁全文
5万+

被折叠的 条评论
为什么被折叠?



