Hello,

I have this which is supposed to run a SQL, however I get a compile error. I recorded this using the Macro Recorder...

Does any have any ideas why? (Portion in RED is where the error is)

Here is the whole thing...so what should I do to fix this or what is causing this?

Thanks.

Sub AddVantage_SQL()
'
' AddVantage_SQL Macro
' Macro recorded 4/5/2007 by user
'

'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "ODBC;DSN=AddVantage Cache for TRP;SERVER=xxx.xxx.xxx.xxx;PORT=xxxx;DATABASE=xxxx;AUTHENTICATION METHOD=0;UID=user;;QUERY TIMEOUT=1" _
        , Destination:=ActiveCell)
        .CommandText = Array( _
        "SELECT AC_BI.ACCOUNTANT, AC_BI.ACCOUNT_NAME_FIRST, AC_BI.ACCOUNT_NAME_LAST, AC_BI.ACCOUNT_NUMBER, AC_BI.ACCOUNT_TAX_TYPE, AC_BI.ACCOUNT_TAX_TYPE_TEXT, AC_BI.ACCT_SUB_TYPE, AC_BI.ADDRESS_01, AC_BI.ADDR" _
        , _
        "ESS_02, AC_BI.ADDRESS_03, AC_BI.ADDRESS_04, AC_BI.ADDRESS_05, AC_BI.ADMIN_BRANCH_NUMBER, AC_BI.ADMIN_OFFICER, AC_BI.ALTERNATE_ACCOUNT_NUMBER_01, AC_BI.ALTERNATE_ACCOUNT_NUMBER_02, AC_BI.ANNUAL_ACCT_DA" _
        , _
        "TE, AC_BI.APPOINT_DATE, AC_BI.BASIS_POINT_FEE_RATE, AC_BI.BRANCH_NUMBER, AC_BI.CASH_MGMT_BASIS_PT_FEE_RATE, AC_BI.CONSOL_FEE_TRANS_ON_CS1_TO_CS7, AC_BI.CONTROL_ACCOUNT_TYPE, AC_BI.CONTROL_ACCOUNT_TYPE" _
        , _
        "_TEXT, AC_BI.COUNTY_CODE, AC_BI.DATE_FORM_W9_RECEIVED, AC_BI.DIST_SUBJ_MA_INHERIT_TX, AC_BI.DIST_SUBJ_MA_INHERIT_TX_TEXT, AC_BI.EXCLUDE_FROM_SCHEDULE_RCT, AC_BI.FEE_REBATE_EXCLUDED_FUNDS_01, AC_BI.FEE" _
        ,,,,,,,,,)
        .Name = "Query from AddVantage Cache for TRP"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .PreserveColumnInfo = True
        .Refresh BackgroundQuery:=False
    End With
End Sub