How Can I Manage Error Code Sql In Ms Access Form Database?
I want manage SQL server error code in access form sample duplicate error from SQL server
Solution 1:
In Access VBA, you need to use:
OnErrorGoTo Error_Handler
' YOUR CODE HERE
.
.
.
Return_Label:ExitFunctionError_Handler:'What goes here depends on the data access modelResume Return_Label
Solution 2:
You may have to retrieve the Errors collection of the Error object as described here.
It shows this example code:
Sub DescriptionX()
Dim dbsTest As Database
OnErrorGoTo ErrorHandler
' Intentionally trigger an error. Set dbsTest = OpenDatabase("NoDatabase")
ExitSubErrorHandler:Dim strError AsStringDim errLoop AsError' Enumerate Errors collection and display properties of ' each Error object. ForEach errLoop In Errors
With errLoop
strError = _
"Error #" & .Number & vbCr
strError = strError & _
" " & .Description & vbCr
strError = strError & _
" (Source: " & .Source & ")" & vbCr
strError = strError & _
"Press F1 to see topic " & .HelpContext & vbCr
strError = strError & _
" in the file " & .HelpFile & "."EndWith
MsgBox strError
NextResumeNextEndSub
Post a Comment for "How Can I Manage Error Code Sql In Ms Access Form Database?"