VBA中的字符串分隔符

时间:2018-01-24 09:50:36

标签: excel vba excel-vba

我是VBA的新手,我正在模块中编写查询。 目前我收到语法错误。我相信这是因为我错放了一个“暗示一个字符串。 但是,我看不到它。也许这是另一个错误......任何人都可以看看吗?

代码:

        QryInsertTracks = "INSERT INTO IMP_TRACK_GLOBAL_INFO VALUES (" & recTracksMissing(0) & ", " & recTracksMissing(1) & ", " & recTracksMissing(2) & ", " & recTracksMissing(3) & ", " & _
            recTracksMissing(4) & ", " & "'" & fixQuotes(recTracksMissing(5)) & "' , " & "'" & recTracksMissing(6) & "' , " & "'" & recTracksMissing(7) & "' , " & _
            "'" & recTracksMissing(8) & "', " & _
            fixNull(recTracksMissing(9)) & ", " & _
            "'" & fixQuotes(recTracksMissing(10)) & "' , " & _
            recTracksMissing(11) & ", " & _
            fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(12))) & "'") & ", " & _
            "'" & recTracksMissing(13) & "'" & ", '" & recTracksMissing(14) & "', '" & recTracksMissing(15) & "', '" & recTracksMissing(16) & "', " & fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(17))) & "'") & ", " & _
            "'" & fixQuotes(recTracksMissing(18)) & "' , " & _
            fixNull(recTracksMissing(19)) & ", " & _
            "'" & fixQuotes(fixNull(recTracksMissing(20))) & "' , " & _
            fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(21))) & "'") & ", " & _
            fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(22))) & "'") & ", " & _
            fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(23))) & "'") & ", " & _
            fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(24))) & "'") & ", " & _
            fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(25))) & "'") & ", " & _
            "'" & recTracksMissing(26) & "' , " & _
            "'" & recTracksMissing(27) & "' , " & _
            fixNull(recTracksMissing(28)) & ", " & _
            fixNull(recTracksMissing(29)) & ", " & _
            "'" & recTracksMissing(30) & "' , " & _
            fixNull(recTracksMissing(31)) & ", " & _
            "'" & recTracksMissing(32) & "' , " & _
            "'" & fixQuotes(recTracksMissing(33)) & "' , " & _
            "'" & recTracksMissing(34) & "', '" & Now & "', " & fixNullAgain("'" & fixQuotes(fixNull(recTracksMissing(35))) & "'") & ", " & fixNull(recTracksMissing(36)) & ", " & fixNull(recTracksMissing(37)) & ")"

1 个答案:

答案 0 :(得分:3)

  1. 在你写完之后写Stop;
  2. 运行代码;
  3. 它会停在Stop字;
  4. Ctrl + G
  5. 撰写?QryInsertTracks并按Enter
  6. 看看结果 - 它应该是可见的;