Help with combobox query to only show trips > Date()
Hi guys
In a combo box in my db you can select a trip from it, but i want it to only show trips where date of departure is greater than todays date... but also it needs to only be filled ONLY IF the fhe field DateOfDeparture is NOT NULL - otherwise when you're viewing old trips (before todays date), there will be nothing in the date of departure box....
here's my sql WITHOUT my attempt to do this (remember it's for a combo box):
SELECT tblTrips.TripID, tblTrips.TripDestination, tblTrips.TripReferenceNumber, tblTrips.DateOfDeparture, tblTrips.DateOfReturn
FROM tblTrips
WHERE (((tblTrips.TripType)=[Forms]![frmTripDetail4]![TripType]))
ORDER BY tblTrips.TripDestination, tblTrips.DateOfDeparture;
But when i enter "IF NOT NULL > Date()" or "IF [tblTrips].[DateOfDeparture] NOT NULL > Date()" or other variations it doesn't work. Here's what happens in one case:
SELECT tblTrips.TripID, tblTrips.TripDestination, tblTrips.TripReferenceNumber, tblTrips.DateOfDeparture, tblTrips.DateOfReturn
FROM tblTrips
WHERE (("IF NOT NULL">Date()) AND ((tblTrips.TripType)=[Forms]![tblTripDetail4]![TripType]))
ORDER BY tblTrips.TripDestination, tblTrips.DateOfDeparture;
The problem is i don't have enough knowledge of the SQL syntax to work this on out - can anyone lend a hand? Cheers
Cheers again
Hi guys
In a combo box in my db you can select a trip from it, but i want it to only show trips where date of departure is greater than todays date... but also it needs to only be filled ONLY IF the fhe field DateOfDeparture is NOT NULL - otherwise when you're viewing old trips (before todays date), there will be nothing in the date of departure box....
here's my sql WITHOUT my attempt to do this (remember it's for a combo box):
SELECT tblTrips.TripID, tblTrips.TripDestination, tblTrips.TripReferenceNumber, tblTrips.DateOfDeparture, tblTrips.DateOfReturn
FROM tblTrips
WHERE (((tblTrips.TripType)=[Forms]![frmTripDetail4]![TripType]))
ORDER BY tblTrips.TripDestination, tblTrips.DateOfDeparture;
But when i enter "IF NOT NULL > Date()" or "IF [tblTrips].[DateOfDeparture] NOT NULL > Date()" or other variations it doesn't work. Here's what happens in one case:
SELECT tblTrips.TripID, tblTrips.TripDestination, tblTrips.TripReferenceNumber, tblTrips.DateOfDeparture, tblTrips.DateOfReturn
FROM tblTrips
WHERE (("IF NOT NULL">Date()) AND ((tblTrips.TripType)=[Forms]![tblTripDetail4]![TripType]))
ORDER BY tblTrips.TripDestination, tblTrips.DateOfDeparture;
The problem is i don't have enough knowledge of the SQL syntax to work this on out - can anyone lend a hand? Cheers
Cheers again