I'm having a problem getting the syntax right using the Right function with a variable in a DAO recordset using the FindFirst function.
Here's the relevant lines of code. The field [Sn_Scan] is text
Dim intSnGuessLen As Integer
(1st Version)
rst.FindFirst "Right([Sn_Scan],6) ='" & strGuessSN & "'"
(Needed Version)
rst.FindFirst "Right([Sn_Scan],intSnGuessLen) ='" & strGuessSN & "'"
When I hard code the value of intSnGuessLen (i.e. 6) directly as in the 1st Version of the line it works perfectly however I need the function to dynamically plug in the value of intSnGuessLen and can not get the syntax right.
The error I get with the needed version is "microsoft jet database engine does not recognize "intSnGuessLen" as a valid field or expression
Can someone help me with the syntax?