Item cannot be found in the collection corresponding to the requested name or ordinal.
The Function call I am using is:
Expand|Select|Wrap|Line Numbers
- =getNextLastActivityDataPlanReviewScore([ID],"Review","TARGET_DATE","InitialScore")
Here is the Function Code:
Expand|Select|Wrap|Line Numbers
- 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