I am currently attempting to build a reservation system. One of the main objectives is to search by date to check for availability on a particular date. At the moment, user selects a date from datepicker to check for availability. if a room is booked, the room no. will appear in a text box. However as it stands this is only useful if there is only one room booked for a particular date. How would i go about representing several rooms booked for a specific date?
Thanks!!
Private Sub CMDSEARCHVACANCIES_Click()
Dim sSQL As String
Let X = Format(DTPicker6.Value, "MM/dd/yyyy"
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
If Not rs.EOF Then
txtRoom.Text = rs!RoomNo
txtDate.Text = rs!Date
txtGuestName.Text = rs!Name
Else
txtRoom.Text = "Available"
txtDate.Text = "Available"
txtGuestName.Text = ""
End If
rs.Close
End Sub
Thanks!!
Private Sub CMDSEARCHVACANCIES_Click()
Dim sSQL As String
Let X = Format(DTPicker6.Value, "MM/dd/yyyy"
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
If Not rs.EOF Then
txtRoom.Text = rs!RoomNo
txtDate.Text = rs!Date
txtGuestName.Text = rs!Name
Else
txtRoom.Text = "Available"
txtDate.Text = "Available"
txtGuestName.Text = ""
End If
rs.Close
End Sub