You can also use a helper function like below.
I happen to use an enum because it is used in several procedures.
you'd call it like
Code:
strSQL = strSQL & "[Vriety]=" & Dlmt(Me!VarietyCbo,DoubleQuotes)
Code:
Public Enum eDelimiterType
NoDelimiter = 0
DoubleQuotes = 1
Octothorpes = 2
SingleQuotes = 3
End Enum
Code:
Public Function Dlmt(objIN As Variant, Optional Delimiter As eDelimiterType = 1) As Variant
'returns the passed in value wrapped with the selected delimiter
On Error GoTo Dlmt_Error
Dim DeLimit As String
Select Case Delimiter
Case 0
DeLimit = Null
Case 1
DeLimit = Chr(34) 'Quotes
Case 2
DeLimit = Chr(35) 'Octothorpes
Case 3
DeLimit = Chr(39) 'SingleQuotes
End Select
Dlmt = DeLimit & objIN & DeLimit
On Error GoTo 0
Exit Function
Dlmt_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Dlmt, line " & Erl & "."
End Function