首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

“运行时异常‘-2147206461’(80043ac3)未找到文件”

2012-01-08 
“运行时错误‘-2147206461’(80043ac3)未找到文件”在VB中用到过水晶报表,在编辑状态下一切都好用。可是编译成

“运行时错误‘-2147206461’(80043ac3)未找到文件”
在VB中用到过水晶报表,在编辑状态下一切都好用。
可是编译成EXE文件后,打印时出错:
“运行时错误‘-2147206461’(80043ac3)未找到文件”

请问这是怎么回事呢〉
急死了!
请大虾们指点,不胜感激,必以高分相送。

[解决办法]
用这个试试:
RunTime Error Handler

' Call generalized procedure for error handling and check result to
' decide where to resume
Private Sub CodeWithErrorHandler()
On Error GoTo ErrHandler
'...Procedure code ...
'...
Exit Sub
ErrHandler:
'Pass error to general purpose error-handling routine
Action = HandleError(Err.Number)
'Take action based on result of function
If Action = MyResume Then
Resume ' execute same line of code
ElseIf Action = MyResumeNext Then
Resume Next ' execute next line of code
End If
End Sub
Private Function HandleError(ErrNum As Integer) As Integer
Select Case Err.Num
Case 53 'File not found
answer=MsgBox( "File not found. Try again? ", _
vbYesNo)
Case 76 'Path not found
answer=MsgBox( "Path not found. Try again? ", _
vbYesNo)
Case Else 'unknown error
MsgBox "Unknown error. Quitting now. " 'SHOULD LOG ERROR!
Unload Me
End Select
If answer = vbYes Then
HandleError = MyResume 'tell calling procedure to resume
ElseIf answer = vbNo Then
HandleError = MyResumeNext 'tell calling procedure to resume next
End If
End Function

[解决办法]
Public Sub OutPutErrMsg(FunctionName As String, ModuleName As String)

Dim lngErrFileNo As Long
lngErrFileNo = FreeFile
Open App.Path & "\Errmsg.txt " For Append As lngErrFileNo
Print #lngErrFileNo, "ErrMsg: " & Format$(Now, "YYYY-MM-DD HH:MM:SS ") & ", " & Err.Number & ", " & Err.Description & ", " & FunctionName & ", " & ModuleName
Close #lngErrFileNo

End Sub
用这个函数增加错误记录

热点排行