Hi all,
I am trying to open a record set based on a query and then with the results of the query, post 2 values in to 2 variables for use later on in a module.
My code so far is:
But it doesn't work and I don't understand! All it is is a text field
I would value your assistance.
Many thanks,
Simon
I am trying to open a record set based on a query and then with the results of the query, post 2 values in to 2 variables for use later on in a module.
My code so far is:
Code:
Dim strBanksianWinner1 As String
Dim strBanksianWinner2 As String
Dim strSelect1 As String
Dim rs As DAO.Recordset
Dim strSQL As String
strSelect1 = "SELECT TOP 2 tblBanksianWinners.chrEntrant" _
& " FROM tblBanksianWinners" _
& " ORDER BY tbBanksianWinners.dtmShowDate DESC;"
strSQL = strSelect1
MsgBox strSQL 'for debugging purposes
Set rs = CurrentDb.OpenRecordset(strSQL)
rs.MoveFirst
strBanksianWinner1 = rs.Fields("chrEntrant")
rs.MoveLast
strBanksianWinner2 = rs.Fields("chrEntrant")
rs.Close
Set rs = Nothing
But it doesn't work and I don't understand! All it is is a text field
I would value your assistance.
Many thanks,
Simon