Hi! Just wonder how i would carry out a search for availability between two dates. I can reserve a room for several dates but i want to be able to search for availability between two dates. At the moment i can only search one date at a time....any ideas
Private Sub DTPicker6_Change()
Dim sSQL As String
Let X = Format(DTPicker6.Value, "MM/dd/yyyy"
SearchGrid.Clear
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source = H:\IS4401Project\db.mdb"
sSQL = "Select * from BookedRooms where Date = #" & X & "#;"
Set rs = New ADODB.Recordset
rs.Open sSQL, adoconnection
SearchGrid.FormatString = "<Room Number |< Guest "
Dim introw As Integer
Dim rows As Integer
With SearchGrid
rows = 1
If rs.BOF Then
MsgBox "No Bookings for the date selected", vbInformation, "Information"
Else
rs.MoveFirst
While Not rs.EOF
rows = rows + 1
rs.MoveNext
Wend
.rows = rows
.Cols = 2
introw = 1
If rs.BOF Then
MsgBox "The recordset is empty. No records exist"
Else
SearchGrid.Visible = True
rs.MoveFirst
While Not rs.EOF
.TextMatrix(introw, 0) = rs!RoomNo
.TextMatrix(introw, 1) = rs!Name
rs.MoveNext
introw = introw + 1
Wend
Set rs = Nothing
End If
End If
End With
End Sub
Private Sub DTPicker6_Change()
Dim sSQL As String
Let X = Format(DTPicker6.Value, "MM/dd/yyyy"
SearchGrid.Clear
Dim adoconnection As ADODB.Connection
Set adoconnection = New ADODB.Connection
adoconnection.Open ("Provider=Microsoft.jet.oledb.4.0;" & "Data Source = H:\IS4401Project\db.mdb"
sSQL = "Select * from BookedRooms where Date = #" & X & "#;"
Set rs = New ADODB.Recordset
rs.Open sSQL, adoconnection
SearchGrid.FormatString = "<Room Number |< Guest "
Dim introw As Integer
Dim rows As Integer
With SearchGrid
rows = 1
If rs.BOF Then
MsgBox "No Bookings for the date selected", vbInformation, "Information"
Else
rs.MoveFirst
While Not rs.EOF
rows = rows + 1
rs.MoveNext
Wend
.rows = rows
.Cols = 2
introw = 1
If rs.BOF Then
MsgBox "The recordset is empty. No records exist"
Else
SearchGrid.Visible = True
rs.MoveFirst
While Not rs.EOF
.TextMatrix(introw, 0) = rs!RoomNo
.TextMatrix(introw, 1) = rs!Name
rs.MoveNext
introw = introw + 1
Wend
Set rs = Nothing
End If
End If
End With
End Sub