我的代码给了我编译错误,预期:列表分隔符或);然后我添加一些)或“以不同的模式,只是得到类型不匹配

时间:2014-01-28 15:49:26

标签: list vba compiler-errors separator

With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
    "ODBC;DSN=REPORTDB;UID=reports;PWD=reports;SERVER=REPORTDB;", Destination:=Range("$A$1") _
    ).QueryTable
    .CommandText = Array( _
    "SELECT NCM_HEADER.NCR_KEY, NCM_HEADER.PART_NUMBER, NCM_HEADER.PART_NAME, NCM_HEADER.NCR_DISPLAY_STATUS, NCM_HEADER.WORK_ORDER, NCM_SIGNOFF.GROUP_NAME, NCM_SIGNOFF.DATE_IN_QUEUE" & Chr(13) & "" & Chr(10) _
    & "FROM HMS.NCM_HEADER NCM_HEADER, HMS.NCM_SIGNOFF NCM_SIGNOFF" & Chr(13) & "" _
, _
"" & Chr(10) & "WHERE NCM_HEADER.NCR_KEY = NCM_SIGNOFF.NCR_KEY AND ((NCM_HEADER.WORK_ORDER = '03530' And (NCM_HEADER.NCR_DISPLAY_STATUS = 'OPEN'))" _
   )     

 .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .PreserveColumnInfo = True
    .ListObject.DisplayName = "Table_Query_From_REPORTDB_1"
    .Refresh BackgroundQuery:=False
    End With

问题以SELECT NCM开始和结束一直到'打开'。我似乎无法让这个工作,虽然我有相同的模式和DB工作的其他代码。只是找不到粗体字符串的错误。

在OPEN之后进行编辑))“_);现在给出类型不匹配。

0 个答案:

没有答案