Hi everybody,
I am struggling with finding the write way to achieve a certain task. I hope someone can help me.
Problem:
I have a table
[reservation_tb]
-reserveID
-roomID
-from :[date datatype]
-to :[date datatype]
-status
On Reservation form. I have a button that will check if the reservation_tb table has a room reserved within the date of the new reservation.
Solution Attempt:
I tried to use a DCount function but it seams to be giving me the wrong result.
when i debug, it looks like the value in the [from] is from the FORM and not from [reservation_tb].
I can't quite figure out how to solve that.
Thank You in advance.
I am struggling with finding the write way to achieve a certain task. I hope someone can help me.
Problem:
I have a table
[reservation_tb]
-reserveID
-roomID
-from :[date datatype]
-to :[date datatype]
-status
On Reservation form. I have a button that will check if the reservation_tb table has a room reserved within the date of the new reservation.
Solution Attempt:
I tried to use a DCount function but it seams to be giving me the wrong result.
Code:
Dim intRoomID, num As Integer
Dim varFrom, varTo
varFrom = Me.from.Value
varTo = Me.to.Value
intRoomID = Me.comboRoom.Value
num = DCount("[roomID]", "[reservation_tb]", "[roomID] = " & intRoomID & " _
And [from] between " & varFrom & " and " & varTo & "")
If num > 0 Then
MsgBox "Already Exist"
Else
MsgBox "Reserved Succesfully"
End If
I can't quite figure out how to solve that.
Thank You in advance.
Comment