Results 1 to 12 of 12

runtime error 13 type mismatch

Threaded View

  1. #11
    Registered User
    Join Date
    08-30-2012
    Location
    Chandler, AZ
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: runtime error 13 type mismatch

    Hi, i get the same runtime error in my VBA macro. My code is below. now the funny thing is if I delete "StartInsTime" my code runs, but if I include it i get the runtime error. Any clues on how to resolve this?

    With ActiveSheet.QueryTables.Add(Connection:=Array( _
            "OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=Mscan100_db;Data Source=IntelDb2\MSSQL20" _
            , _
            "08;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=INTELDB2;Use Encryption for Data=False;Tag wi" _
            , "th column collation when possible=False"), Destination:=Range("A1"))
            .CommandType = xlCmdSql
            '.CommandText = Array(sel_clause & frm_clause & whe_clause)
                  
            .CommandText = Array( _
            "SELECT DISTINCT " & "LotSn" & "," & "Orientation" & "," & "PanelSn" & "," & IP & "." & IPI & "," & "StartInspTime" & "FROM InspPasses Inner Join " & IPS & " ON InspPassSubstrates.InspPassID = InspPasses.InspPassID  Inner Join" & Chr(10) & "     InspRunSubstrates ON InspRunSubstrates.InspRunSubstID = InspPas" _
            , _
            "sSubstrates.InspRunSubstID  Inner Join" & Chr(10) & "     InspPassDefects ON ((InspPassDefects.hlp_SubstID = InspRunSubstrates.SubstID) AND (InspPassDefects.hlp_InspPassID = InspPasses.InspPassID))  Inner Join" & Chr(10) & "     BT_DefectResultCode ON BT_Def" _
            , _
            "ectResultCode.DefectResultCodeID = InspPassDefects.DefectResultCodeID Inner Join" & Chr(10) & "     InspRuns ON InspRuns.InspRunID = InspPasses.InspRunID  Inner Join" & Chr(10) & "     BT_InspRuns ON BT_InspRuns.BT_InspRunID = InspRuns.BT_InspRunID  Inner Jo" _
            , _
            "in" & Chr(10) & "     BT_Products ON BT_Products.ProdID = BT_InspRuns.ProdID  Inner Join" & Chr(10) & "     BT_DieCoordinates ON ((BT_DieCoordinates.DieNr = InspPassDefects.hlp_DieNr) AND (BT_DieCoordinates.SubstTypeID = BT_Products.SubstTypeID))     " & Chr(10) & " Where" _
            , " InspPasses.InspPassID in ('8135')")
            
            
            .Name = "INTELDB2_MSSQL2008 Mscan100_db"
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .BackgroundQuery = True
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
            .PreserveColumnInfo = True
            .SourceConnectionFile = _
            "C:\Documents and Settings\Valued Customer\My Documents\My Data Sources\INTELDB2_MSSQL2008 Mscan100_db.odc"
            .Refresh BackgroundQuery:=False
        End With
        End Sub
    Last edited by dp1; 08-30-2012 at 09:58 PM. Reason: tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1