Function RoomInUse() As Boolean
Dim room As String
Dim day As String
Dim tmein As Date
Dim tmeout As Date
Dim mond As String
Set rs = New ADODB.Recordset
With rs
mond = "select * from tblsched where room Like '" & Combo2.Text & "%' and day like '" & Combo3.Text & "' and (tmein <= #" & Combo1 & "# And " & _
"tmeout >= #" & Combo1 & "#) Or (#" & Combo1 & "#" & _
"<= tmein And tmeout < #" & Combo8 & "#) Or (#" & _
Combo1 & "# <= tmein And tmein < #" & Combo8 & "#)) " '"
.Open mond, con, 3, 3
End With
If rs.RecordCount >= 1 Then
RoomInUse = True
Else
RoomInUse = False
End If
End Function
What I want is if there is already a schedule in a room for example ROOM 1 in 7:00 AM - 9:00 AM in monday .then i add new schedule in the same room then in the time 8:00 AM - 9:30 AM the same day also then.the second record will not be save because there is still session in that room (7:00-9:00) it is not over yet so i want that there must be msgbox that tells the room is still occupied.
Translation(?): Don't allow conflicts in scheduling with overlapping time.