使用连字符引用字段的正确语法是什么?

What is the correct syntax for referencing a field with a hyphen?

我有一个索引字段,如果尝试在表单上重复输入,我想为用户提供导航到原始记录的选项。我尝试了以下代码,改编自对我发现的类似问题 here 的回答。

在我的例子中,[BOL] 字段是一个可能包含多个连字符的文本字段。 Me.BOL 需要使用什么语法?例如,当我尝试在我的 BOL 字段中输入 "CT-J17-XUSH-T001" 时,我收到错误消息:运行-time error '3070': The Microsoft Access database engine does not recognize 'CT' as有效的字段名称或表达式。

Private Sub BOL_BeforeUpdate(Cancel As Integer)


'

Set rst = Me.RecordsetClone
rst.FindFirst "[ShipmentNumber] <> " & Me.ShipmentNumber & " AND [BOL] = " & Me.BOL
If Not rst.NoMatch Then
    Cancel = True
    If MsgBox("BOL already exists; goto existing record?", vbYesNo) = vbYes Then
        Me.Undo
        DoCmd.SearchForRecord , , acFirst, "[ShipmentNumber] = " & rst("ShipmentNumber")
    End If
End If
rst.Close

End Sub

在文本字段值周围添加单引号:

rst.FindFirst "[ShipmentNumber] <> " & Me.ShipmentNumber & " AND [BOL] = '" & Me.BOL & "'"