UD_SaveDataErrorHandle:
AccountConnection.RollbackTrans '取消這次的交易
Dim UD_SaveDataError As ADODB.Error
Dim UD_SaveDataErrorMsg As String
UD_SaveDataErrorMsg = Err.Number & ": " & Err.Description
MsgBox "資料存檔失敗!!" & UD_SaveDataErrorMsg
For Each UD_SaveDataError In AccountConnection.Errors
If UD_SaveDataError.Number = -2147217900 Then
*************************************
msg = "Number: " & UD_SaveDataError.Number & vbCrLf & _
"Description: " & "單身的程式代號資料有重覆.請更改.." & vbCrLf & _
"Source: " & UD_SaveDataError.Source & vbCrLf & _
"NativeError: " & UD_SaveDataError.NativeError
End If
MsgBox UD_SaveDataErrorMsg
Next
ps..我想跟據不同的error number來顯示不同訊息,但是沒用..監看視窗裏看到的明明是 -2147217900 .