The creation and customization of database applications using Microsoft Access
I found the answer.
I reset the references to:
I modified the VBA code:
Private rsData As Recordset
Public Function Most_Recent_By_GameID_And_Date(ByVal lngGameID As Long, _
ByVal dtmDate As Date) _
As Recordset
'Purpose: Finds the days the games are drawn
'Parameters: lngGameID As Long - Game ID number
'Returns: A recordset
'Dim rs As Recordset
On Error GoTo Most_Recent_By_GameID_And_Date_Err
Set dbs = CurrentDb
strSQL = "SELECT TOP 1 * FROM tblActual_Draw " & _
"WHERE (((tblActual_Draw.GameID) = " & [lngGameID] & ") " & _
"AND ((tblActual_Draw.Drw_Date) = #" & [dtmDate] & "#)) " & _
"ORDER BY tblActual_Draw.Drw_Date DESC;"
Set rsData = dbs.OpenRecordset(strSQL)
With rsData
If .RecordCount <> 0 Then
'Populate RecordSet
Debug.Print ("Record Count = " & CStr(rsData.RecordCount))
Set Most_Recent_By_GameID_And_Date = rsData
Else
Set Most_Recent_By_GameID_And_Date = Nothing
End If
End With
Most_Recent_By_GameID_And_Date_Exit:
On Error Resume Next
Exit Function
Most_Recent_By_GameID_And_Date_Err:
'Log error
Call LogError(Err.Number, _
Err.Description, _
"modFunctions Function Most_Recent_By_GameID_And_Date", _
Now)
Resume Most_Recent_By_GameID_And_Date_Exit
End Function
It seems I need to define a RecordSet of object as RecordSet not ADODB.RecordSet.
Thanks
