我在这段代码中遇到错误语法错误(缺少运算符)
For i = 0 To Me.listMachineSubSystem.ListCount - 1
rs.FindFirst "[Machine ID]=" & ID & "[MachineSystem]=" & DLookup("[MachineSystem]", "tblMachineSystem", "[Machine System ID]=" & Me.listMachineSubSystem.Column(2, i))
rs1.AddNew
rs1![MachineSubsystem] = Me.listMachineSubSystem.Column(1, i)
rs1![Machine Sytem ID] = rs![Machine System ID]
rs1.Update
Next i
答案 0 :(得分:2)
您需要考虑间距,在检查多个条件时使用AND
关键字,并在需要时使用分隔符(字符串)。
如果MachineSystem
是数字:
rs.FindFirst "[Machine ID]= " & ID & " AND [MachineSystem]=" & DLookup("[MachineSystem]", "tblMachineSystem", "[Machine System ID]=" & Me.listMachineSubSystem.Column(2, i))
如果MachineSystem
是字符串:
rs.FindFirst "[Machine ID]= " & ID & " AND [MachineSystem]= '" & DLookup("[MachineSystem]", "tblMachineSystem", "[Machine System ID]=" & Me.listMachineSubSystem.Column(2, i)) & "'"