I have a DLookup field (DrgNo) in a query (qryItems) which is used in the
attached (part) function. The purpose of the function is to concatenate
the
contents of a field in a query. The arguments are passed to the function
successfully but the code fails at the line
Set rs = db.OpenRecordset(strSQL)
with the error "Too few parameters, expected 1".
This function worked before I had to change the DrgNo field to a DLookup
and
if I copy the contents of strSQL at run-time to a regular query it runs.
Is
this a DLookup issue or am I missing something else?
Many thanks.
Keith.
Public Function libConcatenate(lngID As Long, strSysCode As String) As
String
Dim db As DAO.Database, rs As DAO.Recordset, strSQL As String, strResult
As
String
Set db = CurrentDb
strSQL = "Select Item, DrgNo from qryItems where CertID = " & lngID & "
and
[SysCode] = '" & strSysCode & "' order by Item"
Set rs = db.OpenRecordset(strSQL)
If rs.RecordCount = 0 Then Exit Function