I am getting a Run-Time error '3265':
Item cannot be found in the collection corresponding to the requested name or ordinal.
The Function call I am using is:
I think that is has something to do with sReturn = rst("sScore") in my function. But I am not 100% sure. Any Ideas would help.
Here is the Function Code:
Thanks for any help,
Darkhat01
Item cannot be found in the collection corresponding to the requested name or ordinal.
The Function call I am using is:
Code:
=getNextLastActivityDataPlanReviewScore([ID],"Review","TARGET_DATE","InitialScore")
Here is the Function Code:
Code:
Public Function getNextLastActivityDataPlanReviewScore(nID, sType, sNextLast, sScore)
Dim cnThisConnect As ADODB.Connection
Set cnThisConnect = CurrentProject.Connection
Dim rst As New ADODB.Recordset
Dim sSQL As String
Dim sReturn As String
sSQL = "SELECT " & sNextLast & " AS fDate FROM DATA_PLAN_ACTIVITIES "
sSQL = sSQL & " WHERE DATA_PLAN_ACTIVITIES.ACTIVITY_TYPE = '" & sType & "' "
sSQL = sSQL & " AND DATA_PLAN_ACTIVITIES.APP_ID = " & nID
sSQL = sSQL & " AND DATA_PLAN_ACTIVITIES." & sScore
sSQL = sSQL & " AND " & sNextLast & " IS NOT NULL "
sSQL = sSQL & " AND " & sScore & " IS NOT NULL "
sSQL = sSQL & " ORDER BY " & sNextLast & " DESC"
rst.Open sSQL, cnThisConnect, adOpenKeyset, adLockOptimistic
If Not rst.BOF Then
rst.MoveFirst
sReturn = rst("sScore")
Else
sReturn = "None"
End If
rst.Close
cnThisConnect.Close
Set rst = Nothing
Set cnThisConnect = Nothing
MsgBox (sReturn)
getNextLastActivityDataPlanReviewScore = sReturn
End Function
Darkhat01
Comment