I am getting an error and cannot figure it out. I think it is something little that is going to make me feel silly...but it is driving me nuts!
Run-time error '-2147217900 (80040e14)':
Invalid SQL statement; expected 'Delete', 'Insert', 'Procedure', 'Select', or 'Update'.
It stops on this line...
Set rs = CurrentProject.Connection.Execute(pstrSQL)
When I put my cursor over pstrSQL, it shows pstrSQL = "MA 100" (which is the value of the first record in the field [3-PartNumber].
rs is still equal to Nothing...of course because of the error.
Any ideas??
Thanks in advance!
Query:
SELECT tblTestRequestParts.[1-LTRNumber], ConcatenatePartNumber([3-PartNumber]) AS PartNumber
FROM tblTestRequestParts;
Code:
Function ConcatenatePartNumber(pstrSQL As String, _
Optional pstrDelim As String = "', ") _
As String
Dim rs As ADODB.Recordset
Set rs = CurrentProject.Connection.Execute(pstrSQL)
Dim list As String
list = rs.GetString(, , , pstrDelim)
rs.Close
Set rs = Nothing
ConcatenatePartNumber = Left(list, Len(list) - Len(pstrDelim))
End Function