Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search by date 1

Status
Not open for further replies.

aos

MIS
Feb 28, 2002
20
0
0
US
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
 
Hi
How about loop

if not rs.eof then
do while not rs.eof
'get the room nro to combobox ?
rs.movenext
loop
'someting...
endif

Tane **** Keep it simple ***
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top