Hi, we are working with a simple Db that queries data from a table via an ODBC connection.
The main query that we are working with should gather data related to a departement or "HU" together with a date criteia taken from a simple form.
Here is a copy of the SQL:
SELECT dbo_SERVICE_TAXI_VIEW.[ID Bitacora], dbo_SERVICE_TAXI_VIEW.[STI Number], dbo_SERVICE_TAXI_VIEW.Vessel, dbo_SERVICE_TAXI_VIEW.[Voyage Number], dbo_SERVICE_TAXI_VIEW.serviceDate, dbo_SERVICE_TAXI_VIEW.origin, dbo_SERVICE_TAXI_VIEW.destination, dbo_SERVICE_TAXI_VIEW.crews, dbo_SERVICE_TAXI_VIEW.rideComments, dbo_SERVICE_TAXI_VIEW.serviceComments, dbo_SERVICE_TAXI_VIEW.[Division code], dbo_SERVICE_TAXI_VIEW.rideDate
FROM dbo_SERVICE_TAXI_VIEW
GROUP BY dbo_SERVICE_TAXI_VIEW.[ID Bitacora], dbo_SERVICE_TAXI_VIEW.[STI Number], dbo_SERVICE_TAXI_VIEW.Vessel, dbo_SERVICE_TAXI_VIEW.[Voyage Number], dbo_SERVICE_TAXI_VIEW.serviceDate, dbo_SERVICE_TAXI_VIEW.origin, dbo_SERVICE_TAXI_VIEW.destination, dbo_SERVICE_TAXI_VIEW.crews, dbo_SERVICE_TAXI_VIEW.rideComments, dbo_SERVICE_TAXI_VIEW.serviceComments, dbo_SERVICE_TAXI_VIEW.[Division code], dbo_SERVICE_TAXI_VIEW.rideDate
HAVING ((Not (dbo_SERVICE_TAXI_VIEW.[ID Bitacora]) Is Null) AND ((dbo_SERVICE_TAXI_VIEW.[Division code])="HU") AND ((dbo_SERVICE_TAXI_VIEW.rideDate)=[Forms]![TaxiDate_Search]![Texto57]))
ORDER BY dbo_SERVICE_TAXI_VIEW.[ID Bitacora];
The problem being that the [rideDate] feild holds date and time information, ej; 20/12/2014 09:30:21. In this respect, I have to implement the Cdate function, or similar as the user will only be searching by "dd mm YYYY"
I have tried all ways by I always get a message saying that my code is too complex. Here is a cc of my last intent:
HAVING ((Not (dbo_SERVICE_TAXI_VIEW.[ID Bitacora]) Is Null) AND ((dbo_SERVICE_TAXI_VIEW.[Division code])="HU") AND cDate(Int((dbo_SERVICE_TAXI_VIEW.rideDate)=[Forms]![TaxiDate_Search]![Texto57])))
Can someone please help me out here, i'm kinda going mad with this issue.
Thanks in advance.
JMC
The main query that we are working with should gather data related to a departement or "HU" together with a date criteia taken from a simple form.
Here is a copy of the SQL:
SELECT dbo_SERVICE_TAXI_VIEW.[ID Bitacora], dbo_SERVICE_TAXI_VIEW.[STI Number], dbo_SERVICE_TAXI_VIEW.Vessel, dbo_SERVICE_TAXI_VIEW.[Voyage Number], dbo_SERVICE_TAXI_VIEW.serviceDate, dbo_SERVICE_TAXI_VIEW.origin, dbo_SERVICE_TAXI_VIEW.destination, dbo_SERVICE_TAXI_VIEW.crews, dbo_SERVICE_TAXI_VIEW.rideComments, dbo_SERVICE_TAXI_VIEW.serviceComments, dbo_SERVICE_TAXI_VIEW.[Division code], dbo_SERVICE_TAXI_VIEW.rideDate
FROM dbo_SERVICE_TAXI_VIEW
GROUP BY dbo_SERVICE_TAXI_VIEW.[ID Bitacora], dbo_SERVICE_TAXI_VIEW.[STI Number], dbo_SERVICE_TAXI_VIEW.Vessel, dbo_SERVICE_TAXI_VIEW.[Voyage Number], dbo_SERVICE_TAXI_VIEW.serviceDate, dbo_SERVICE_TAXI_VIEW.origin, dbo_SERVICE_TAXI_VIEW.destination, dbo_SERVICE_TAXI_VIEW.crews, dbo_SERVICE_TAXI_VIEW.rideComments, dbo_SERVICE_TAXI_VIEW.serviceComments, dbo_SERVICE_TAXI_VIEW.[Division code], dbo_SERVICE_TAXI_VIEW.rideDate
HAVING ((Not (dbo_SERVICE_TAXI_VIEW.[ID Bitacora]) Is Null) AND ((dbo_SERVICE_TAXI_VIEW.[Division code])="HU") AND ((dbo_SERVICE_TAXI_VIEW.rideDate)=[Forms]![TaxiDate_Search]![Texto57]))
ORDER BY dbo_SERVICE_TAXI_VIEW.[ID Bitacora];
The problem being that the [rideDate] feild holds date and time information, ej; 20/12/2014 09:30:21. In this respect, I have to implement the Cdate function, or similar as the user will only be searching by "dd mm YYYY"
I have tried all ways by I always get a message saying that my code is too complex. Here is a cc of my last intent:
HAVING ((Not (dbo_SERVICE_TAXI_VIEW.[ID Bitacora]) Is Null) AND ((dbo_SERVICE_TAXI_VIEW.[Division code])="HU") AND cDate(Int((dbo_SERVICE_TAXI_VIEW.rideDate)=[Forms]![TaxiDate_Search]![Texto57])))
Can someone please help me out here, i'm kinda going mad with this issue.
Thanks in advance.
JMC