Advertisement

07.08.2004 at 06:54AM PDT, ID: 21051892
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

On Error logic problem

Asked by sanders720 in Visual Basic Programming

Tags:

Below, the following lines of code exist.

        On Error GoTo skip1
        Application.Documents.Open PFile

The purpose for this code is in the event the system cannot find the drawing on the server to open.  In  this case, it is supposed to skip and move to the next file.  The logic works, un less there is more than one file that cannot be found, in which case the following runtime error occurs:

Runtime Error -'2145320924 (80210024)'
Method 'Open' of Object 'IAcadDocuments' failed.

Remember, this logic workled great the first time, and even after the first file cannot be found.  It's when the second file cannot be found that thyere is a problem.  I've tried to move the 'On Error' statement to above the Do While loop, but have gotten the same results.

Thanks in advance for any help you can provide.


............Start of Code

Private Sub cmdProcess_Click()
    If Len(Me.cboJobNo.Value) = 0 Then
        MsgBox "Job No must be selected first."
        Me.cboJobNo.SetFocus
        Exit Sub
    End If
   
    If rs.State = 1 Then rs.Close
    If Len(cboJobNo.Value) = 0 Then
        MsgBox "No Job Number Specified"
        JNX = Me.cboJobNo.Value
        SNX = Me.cboSubAssy.Value
        SPX = Me.chkSP1.Value
        FPX = Me.chkFPB1.Value
       
        UserForm_Activate
        Exit Sub
    End If
   
    If Len(cboSubAssy.Value) = 0 Then
        MsgBox "No Sub Assembly Specified"
        JNX = Me.cboJobNo.Value
        SNX = Me.cboSubAssy.Value
        SPX = Me.chkSP1.Value
        FPX = Me.chkFPB1.Value
       
        UserForm_Activate
        Exit Sub
    End If
   
    If chkSP1.Value = False And chkFPB1.Value = False Then
        MsgBox "No Plot Options Selected"
        JNX = Me.cboJobNo.Value
        SNX = Me.cboSubAssy.Value
        SPX = Me.chkSP1.Value
        FPX = Me.chkFPB1.Value
       
        UserForm_Activate
        Exit Sub
    End If
   
    Dim sqlPartNo As String
    sqlPartNo = "SELECT tblBOM.PartNo, tblBOM.SubAssy, tblBOM.PartNo, tblPartsListing.ManufacturedBy FROM tblPartsListing " & _
                "INNER JOIN tblBOM ON tblPartsListing.PartNo = tblBOM.PartNo " & _
                "WHERE (((tblBOM.JobNo) = " & Me.cboJobNo.Value & ") AND " & _
                "((tblBOM.SubAssy) = '" & Me.cboSubAssy.Value & "') AND " & _
                "((tblPartsListing.ManufacturedBy) = '" & "METRO MACHINE" & "'))"
                Debug.Print "sqlPartNo: " & sqlPartNo
               
    rs.Open sqlPartNo, sConn, adOpenKeyset, adLockOptimistic
    On Error GoTo skip2
    rs.MoveFirst
    Debug.Print rs.RecordCount
   
    Dim PN As String
    Dim PATH1 As String
    Dim PATH2 As String
   
   
    Do While Not rs.EOF
        PN = rs.Fields("PartNo")
       
        ' Condition to elliminate the "-n" from PartNo
        Dim PNR As String
        PNR = Right(PN, 2)
       
        Dim PNL As String
        PNL = Left(PNR, 1)

        If PNL = "-" Then
            PN = Left(PN, (Len(PN) - 2))
        End If
       
        ' Condition to ellim inate the "L or "R" from PartNo
        PNR = Right(PN, 1)
        If PNR = "L" Or PNR = "R" Then
            PN = Left(PN, (Len(PN) - 1))
        End If
               
        ' Determine file location per filename
        JN = Left(PN, 5)
        PATH1 = "\\deepblue\Projects\"
       
        If Int(Right(JN, 2)) >= 50 Then
            PATH2 = Left(JN, 3) & "50-" & Left(JN, 3) & "99\"
        Else
            PATH2 = Left(JN, 3) & "00-" & Left(JN, 3) & "49\"
        End If
       
        PATH3 = PATH1 & PATH2
       
        FindFolderName (JN)
       
        Dim PFile As String
        PFile = PATH4 & PN & ".dwg"
        Debug.Print PFile
       
        On Error GoTo skip1
        Application.Documents.Open PFile
       
        If chkSP1.Value = True And chkFPB1.Value = False Then
            ThisDrawing.SendCommand "(setq PLOTYES" & Chr(34) & "Y" & Chr(34) & ")" & vbCr
            ThisDrawing.SendCommand "(setq noprev 0)" & vbCr
            ThisDrawing.SendCommand "SP1" & vbCr
            ThisDrawing.Close
        End If
       
        If chkSP1.Value = False And chkFPB1.Value = True Then
            ThisDrawing.SendCommand "(setq PLOTYES" & Chr(34) & "Y" & Chr(34) & ")" & vbCr
            ThisDrawing.SendCommand "(setq noprev 0)" & vbCr
            ThisDrawing.SendCommand "FPB1" & vbCr
            ThisDrawing.Close
        End If
       
        If chkSP1.Value = True And chkFPB1.Value = True Then
            ThisDrawing.SendCommand "(setq PLOTYES" & Chr(34) & "Y" & Chr(34) & ")" & vbCr
            ThisDrawing.SendCommand "(setq noprev 0)" & vbCr
            ThisDrawing.SendCommand "SP1" & vbCr
            ThisDrawing.SendCommand "FPB1" & vbCr
            ThisDrawing.Close
        End If
       
        GoTo skip3
               
skip1:
        Me.lstMissedPlots.AddItem PN
        rs.MoveNext
        GoTo skip4
   
skip3:
        Me.lstPlotted.AddItem PN
        rs.MoveNext
       
skip4:
    Loop
    MsgBox "Plots are Complete!"
   
    rs.Close
    Exit Sub
   
skip2:
    MsgBox "No Records..."
    rs.Close
   
End Sub
Start Free Trial
[+][-]07.08.2004 at 07:11AM PDT, ID: 11502248

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Visual Basic Programming
Tags: 2145320924
Sign Up Now!
Solution Provided By: Idle_Mind
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07.08.2004 at 08:35AM PDT, ID: 11503160

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2004 at 08:37AM PDT, ID: 11503174

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2004 at 08:38AM PDT, ID: 11503192

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2004 at 08:38AM PDT, ID: 11503198

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2004 at 08:41AM PDT, ID: 11503227

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.08.2004 at 08:47AM PDT, ID: 11503296

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.08.2004 at 08:50AM PDT, ID: 11503334

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32