I think you're going to get problems with some of the rest of the stuff too. I don't konw whether .Index is a property of the DAO recordset object, and issuing a .MoveLast without testing whether there are records might bomb.
Here is a quick clean up on the code. Didn't debug though so may not work. The openrecordset method needs to have the recordset type , dbOpenDynaset or , dbOpenReadonly, OR , dbOpenSnapshot
Check the VB Help for specifics on DAO parameters.
' change the name of the command button to soemthing meaningful
Private Sub cmdSetHireDt_Click()
' no need to set focus your already there
Dim db As Database
Dim qdf As QueryDef
Dim strSQL As String
' DAO ir ADO???? Better make it DAO
Dim rs As DAO.Recordset
' Lets clean thi sup put all dim statements at top
Dim myHall As String
Dim myHireDate As String
Dim myHireTime As String
Set db = CurrentDb
' What happens if I'm null, I go crash/debug
If not isNull(Me.Hall)
myHall = Me.Hall
If Not isNull(Me.DateForHire)
myHireDate = Me.DateForHire
If not isNull(Me.Time)
myHireTime = Me.Time
' Concatenate the SQL, make sure we put (= ' VAR ') quote marks around txt variables.
strSQL = "SELECT [Hall], [DateForHire], [Time]" & _
" FROM tblHallBooking WHERE [HallID] = '" & myHall & "' AND " & _
" [DateForHire] ='" & myHireDate & " AND [Time] = '" & myHireTime & "'"
Set qdf = db.CreateQueryDef
Set rs = qdf.OpenRecordset(STRsql, dbOpenDynaset)
' use rs.recordcount, thats better
'If rs.Index > 0 Then
If rs.Recordcount > 0 then
MsgBox "A booking has already been made with this criteria! Please enter new criteria for a booking."