在VB中用到过水晶报表,在编辑状态下一切都好用。
可是编译成EXE文件后,打印时出错:
“运行时错误‘-2147206461’(80043ac3)未找到文件”请问这是怎么回事呢〉
急死了!
请大虾们指点,不胜感激,必以高分相送。

解决方案 »

  1.   

    用这个试试:
    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 
      

  2.   

    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 #lngErrFileNoEnd Sub
    用这个函数增加错误记录