I have a listbox (SearchResults) on the form "FindGuest" that uses the following rowsource:
This pulls the search string (txtFindGuest) from the form that opens this one.
Elsewhere in this form I have a textbox (txtFind Guest) and a button (cmdFindGuest). The idea is to be able to perform more searches directly from this form after the initial one.
I have the following code in the button's on click event:
Unfortunately I am receiving a "Run-time error 13. Type Mismatch"
The only thing that has changed in the origin of the seach string, but it is still a string.
Why is this happening?
Code:
SELECT tblReservations.ID, tblReservations.PropertyName, tblReservations.GuestName, tblReservations.CheckInDate, tblReservations.CheckOutDate, tblReservations.ReservationDate, tblReservations.Status, tblResOrigin.ResOrigin
FROM tblResOrigin INNER JOIN tblReservations ON tblResOrigin.ID = tblReservations.ReservationSource
WHERE (((tblReservations.GuestName) Like "*" & [forms]![frmPropertyHistory]![txtFindGuest] & "*"))
ORDER BY tblReservations.CheckInDate;
Elsewhere in this form I have a textbox (txtFind Guest) and a button (cmdFindGuest). The idea is to be able to perform more searches directly from this form after the initial one.
I have the following code in the button's on click event:
Code:
Me.SearchResults.RowSource = "SELECT tblReservations.ID, tblReservations.PropertyName, tblReservations.GuestName, tblReservations.CheckInDate, tblReservations.CheckOutDate, tblReservations.ReservationDate, tblReservations.Status, tblResOrigin.ResOrigin," _
& "FROM tblResOrigin INNER JOIN tblReservations ON tblResOrigin.ID = tblReservations.ReservationSource," _
& "WHERE (((tblReservations.GuestName) Like " * " & [Me]![txtFindGuest] & " * "))," _
& "ORDER BY tblReservations.CheckInDate;"
The only thing that has changed in the origin of the seach string, but it is still a string.
Why is this happening?