Hi all, I have managed to completely confuse the crap out of myself with what should be a fairly simple query.
First, here is my SQL code:
I have a form with a subform datasheet that displays which equipment is available based on 2 textboxes on the form called txtDateOutRequested and txtDateInRequested.
In my query I have 3 fields, BOMDescription, DateInReq and DateOutReq. In plain english, I would like to return records where :
txtDateOutRequested AND txtDateInRequested don't fall between a current reservation. I also don't need to show past reservations in the query results, just a list of which equipment is available between txtDateOutRequested and txtDateInRequested.
Any help would be greatly appreciated. Don't hesitate to ask for clarification, which I am sure you will need.
First, here is my SQL code:
Code:
SELECT DISTINCT [1stqryInstrumentAvailabilityForDates].BOMDescription, tblReservations.DateInReq, tblReservations.DateOutReq
FROM tblReservations RIGHT JOIN 1stqryInstrumentAvailabilityForDates ON tblReservations.ReservationID = [1stqryInstrumentAvailabilityForDates].ReservationID
WHERE (((tblReservations.DateInReq)<[Forms]![FrmInstrumentAvailabilityforDates]![txtDateOutRequested] And (tblReservations.DateInReq)<[Forms]![FrmInstrumentAvailabilityforDates]![txtDateInRequested]) AND ((tblReservations.DateOutReq)<[Forms]![FrmInstrumentAvailabilityforDates]![TxtDateOutRequested]<[Forms]![FrmInstrumentAvailabilityforDates]![txtDateInRequested])) OR (((tblReservations.DateInReq) Is Null));
I have a form with a subform datasheet that displays which equipment is available based on 2 textboxes on the form called txtDateOutRequested and txtDateInRequested.
In my query I have 3 fields, BOMDescription, DateInReq and DateOutReq. In plain english, I would like to return records where :
txtDateOutRequested AND txtDateInRequested don't fall between a current reservation. I also don't need to show past reservations in the query results, just a list of which equipment is available between txtDateOutRequested and txtDateInRequested.
Any help would be greatly appreciated. Don't hesitate to ask for clarification, which I am sure you will need.