(Solved) – Skip a column in excel when pulling from SQL

  • by
(solved)-–-skip-a-column-in-excel-when-pulling-from-sql

So I want to skip a column in excel when I am running a select statement in between:

strSql = strSql & ” COLCUDF.Revision#1Date, ”
and
strSql = strSql & ” COLCUDF.FinalActDate, ”

since that column has a formula in it.

Dim rstProjRls As New ADODB.Recordset
Dim cmdProjRls As New ADODB.Command

Set cnnSSVERP = New ADODB.Connection
cnnSSVERP.Open "Driver={SQL Server};Server=" & Range("dbServer") & ";Database=" & Range("dbName") & ";Uid=" & Range("dbUser") & ";Pwd=" & Range("dbPassword") & ";"
cnnSSVERP.CursorLocation = adUseClient

If cnnSSVERP.State Then
Else
    GoTo No_Connection
End If

strSql = ""
strSql = strSql & "Select "
strSql = strSql & " Coalesce(Year(PRI.ShipSchedDate), Year(PRI.PMReq),0) As ReportYearGroup, "
strSql = strSql & " Coalesce(Month(PRI.ShipSchedDate), Month(PRI.PMReq),0) As ReportMonthGroup, "
strSql = strSql & " CO.ID As SalesOrder, "
strSql = strSql & " COLCUDF.ReleaseNo, "
strSql = strSql & " PRI.ProjectName, "
strSql = strSql & " LTrim(COL.MISC_REFERENCE) As Description, "
strSql = strSql & " COCUDF.ProjectType, "
strSql = strSql & " PRI.Plant, "
strSql = strSql & " PRI.ReleaseStatus, "
strSql = strSql & " COLCUDF.EngineerLead, "
strSql = strSql & " COLCUDF.Engineer, "
strSql = strSql & " COCUDF.Estimator, "
strSql = strSql & " PRI.ProjectManager, "
strSql = strSql & " COLCUDF.PostCheck, "
strSql = strSql & " COLCUDF.ProjTODate, "
strSql = strSql & " COLCUDF.CalcNumber, "
strSql = strSql & " COLCUDF.StampDueDate, "
strSql = strSql & " COLCUDF.StampActDate, "
strSql = strSql & " COLCUDF.SubDueDate, "
strSql = strSql & " COLCUDF.SubOutDate, "
strSql = strSql & " COLCUDF.RevisionNumber, "
strSql = strSql & " COLCUDF.InRevision#1Date, "
strSql = strSql & " COLCUDF.Revision#1DueDate, "
strSql = strSql & " COLCUDF.Revision#1Date, "

strSql = strSql & " COLCUDF.FinalActDate, "
strSql = strSql & " PRI.Installation, "
strSql = strSql & " COLCUDF.TCODate, "
strSql = strSql & " COLCUDF.Notes "

Leave a Reply

Your email address will not be published. Required fields are marked *