I have code line like this:
"select count(1) from tblEquipmentRegister where EquipmentID = " & Me.cmbEquipmentID.Value & " and StartTime is null"
which results this string:
"select count(1) from tblEquipmentRegister where EquipmentID = 203203,16 and StartTime is null"
when I pass this string to function
Public Function getOneValue(strSQL As String)
Dim q As QueryDef
Dim rec As Recordset
Set q = CurrentDb.QueryDefs("qTmp")
q.SQL = strSQL
Set rec = q.OpenRecordset
getOneValue = rec.Fields(0).Value
Set q = Nothing
Set rec = Nothing
End Function
I get syntax error (comma) in query expression
I don't get error if EquipmentID is number without a comma.
How should I construct string with a comma in the EquipmentID?