VB Code:
private sub cboUser_Click()
'by mendhak
rs.open "SELECT U.HotelId, U.UserName, H.Location FROM User U LEFT JOIN Hotel H ON U.HotelID = H.HotelId WHERE U.Username ='" & cboUser.Text & "'",YourCN, adOpenStatic, adLockReadOnly
if not (rs.bof and rs.eof) then
'populate your cboLocation
end if
also it's better if the where cluase will be by code, say UserID, like so:
VB Code:
private sub cboUser_Click()
'by mendhak
rs.open "SELECT U.HotelId, U.UserName, H.Location FROM User U LEFT JOIN Hotel H ON U.HotelID = H.HotelId WHERE U.ID =" & cboUser.ItemDate(cbouser.listindex)",YourCN, adOpenStatic, adLockReadOnly
if not (rs.bof and rs.eof) then
'populate your cboLocation
end if