0

我在运行此代码时收到错误 3601,它说参数太少,有什么解决方案吗?

Sub copySDback()
Dim db As DAO.Database

Dim rst As DAO.Recordset

Dim test As String

Dim sdSQL As String

Set db = CurrentDb()
moo = "SD12401064"

sdSQL = "SELECT [Test EUS BL].[Ticket Nbr], [Test EUS BL].[Current Assignment Group],              [Test EUS BL].[ELEVATION STATUS] FROM [Test EUS BL] WHERE ((([Test EUS BL].[Ticket     Nbr])=SD16818515));"
'CurrentDb.OpenRecordset sdSQL

Set rst = db.OpenRecordset(sdSQL, dbOpenDynaset, dbSeeChanges)
If rs.BOF And rs.EOF Then
    rs.Close
    MsgBox "name not found"
End If
Exit Sub

rs.Close
db.Close
4

1 回答 1

1

在您查询的这一部分

WHERE ((([Test EUS BL].[Ticket     Nbr])=SD16818515))

看起来TicketNbr之间有多个空格(这可能是格式问题),但在使用方括号时必须准确。此外,与所需参数问题无关,您需要SD16818515用单引号括起来,例如

'SD16818616'

因为它是一个字符串。

于 2013-04-09T14:44:10.020 回答