I wrote a function to use in an Access Query. The function work once but now it reverts back to the start of the routine when "Set rs = db.OpenRecordset etc." is hit.
Public Function RaceOutlook()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim Fav1 As Integer
Dim Fav2 As Integer
Dim Outlook As Integer
Dim Pace As Integer
Dim nFav1 As Field
Dim nFav2 As Field
Dim nOutlook As Field
Dim nPace As Field
Set db = CurrentDb 'tells program to use the current db
Set rs = db.OpenRecordset("Race Card Contenders", dbOpenDynaset)
Fav1 = rs("nFav1")
Fav2 = rs("nFav2")
Outlook = rs("nOutlook")
Pace = rs("nPace")
Select Case True
Case (Fav1 = 1 And Fav2 = 3 And Outlook = 1 And Pace = 5)
RaceOutlook = 1
Case Else
RaceOutlook = 0
End Select
rs.Close
End Function