I'm trying to build a SQL statement so I can create a recordset from my data. I'm pretty new to this, so I started by working from an existing module. I managed to get this string to work:
...if I set strWhere to "[CondNameF] = """ & [CondName] & """" as an argument in my recordsource.Code:strSql = "SELECT CableNumF FROM CableRoute WHERE " & strWhere & " ORDER BY [CableNumF], [Segment]"
However, I'm trying to build the function completely in VBA. I tried following the instructions here http://www.baldyweb.com/buildsql.htm and came up with the following:
I've tried every variation of quotes and apostrophes I can think of, but when I output the string to my report to test it, I can never get CondName to convert to its contents. All of the fields are text.Code:strSql = "SELECT CableNumF FROM CableRoute WHERE CondNameF = " & Chr$(39) & CondName & Chr$(39) & " ORDER BY [CableNumF], [Segment]"