Private Sub createSequenceDataFiles_Sequence(sPath As String, sTableName As String, iSeqNo As Integer)
Dim RST As DAO.Recordset
Dim nIL As Long, nLastIL As Long
Dim sSQL As String
'
' Get the data from the table
'
sSQL = _
" SELECT [“ & sTableName & “].IL, “ & _
“ [XL]-[FIRST_XL]+1 AS XL_IDX, “ & _
“ [“ & sTableName & “] “ & _
“ FROM [“ & sTableName & “] “ & _
“ INNER JOIN TBL_FIRST_XL_FOR_IL “ & _
“ ON [“ & sTableName & “].IL = TBL_FIRST_XL_FOR_IL.IL “ & _
“ ORDER BY [“ & sTableName & ”].IL, [XL]-[FIRST_XL]+1”
Set RST = CurrentDb.OpenRecordset(sSQL)
While Not RST.EOF
nIL = RST("IL").Value
If Not (nLastIL = nIL) Then
'
' If we've already done one, close the file
'
If nLastIL > 0 Then Close #1
'
' Open the file for the current in-line
'
Open sPath & "\WBS1\IL_" & Format(nIL, "0000") & ".pks" For Append As 1
End If
'
' Write the data
'
Write #1, iSeqNo, RST(“XL_IDX”).value + 1, RST("TIME").Value
nLastIL = nIL
RST.MoveNext
Wend
'
' Close
'
Set RST = Nothing
Close
End Sub
我收到此错误
这有什么问题吗?
这是整个代码,现在我很确定问题出在 SQL 位上,也许我的表名是错误的。