2manyerrors
Programmer
Hi.
I have this query that is not working right. I hope someone can help me.
Here is the situation; I have three fields that I would like to run a query on that must fit the requirements.
Fields:
Name
Date Hire
Date Expired
Conditions:
If the name field is blank, then the records will be displayed.
If the hire date is blank or if it is five days prior to the current date then the records will show and continue to show until it is updated.
If the expired date is blank or if it is five days prior to the current date then the records will show and continue to show until it is updated.
For example if the current date is 12/05/09 I would like the query to pull all the dates that are going to expire or hired on 12/01/09 and before.
My current query looks something like this.
SELECT CPP_Contractors.ID, CPP_Contractors.Contractor, CPP_Contractors.Hire_Date, CPP_Contractors.Expire_Date,
FROM CPP_Contractors
WHERE (((CPP_Contractors.Contractor) Is Null)) OR (((CPP_Contractors.Hire_Date) Is Null)) OR (((CPP_Contractors.Hire_Date)<=Date())) OR (((CPP_Contractors.Hire_Date)=Date()+1)) OR (((CPP_Contractors.Hire_Date)=Date()+2)) OR (((CPP_Contractors.Hire_Date)=Date()+3)) OR (((CPP_Contractors.Hire_Date)=Date()+4)) OR (((CPP_Contractors.Hire_Date)=Date()+5)) OR (((CPP_Contractors.Expire_Date) Is Null)) OR (((CPP_Contractors.Expire_Date)<=Date())) OR (((CPP_Contractors.Expire_Date)=Date()+1)) OR (((CPP_Contractors.Expire_Date)=Date()+2)) OR (((CPP_Contractors.Expire_Date)=Date()+3)) OR (((CPP_Contractors.Expire_Date)=Date()+4)) OR (((CPP_Contractors.Expire_Date)=Date()+5));
Right now sometimes the wrong results is still showing up such as if the date is 05/05/09 and I run the query I would not get a list of records even if the hire date is 05/07/09.
I hope I am making sense.
I have this query that is not working right. I hope someone can help me.
Here is the situation; I have three fields that I would like to run a query on that must fit the requirements.
Fields:
Name
Date Hire
Date Expired
Conditions:
If the name field is blank, then the records will be displayed.
If the hire date is blank or if it is five days prior to the current date then the records will show and continue to show until it is updated.
If the expired date is blank or if it is five days prior to the current date then the records will show and continue to show until it is updated.
For example if the current date is 12/05/09 I would like the query to pull all the dates that are going to expire or hired on 12/01/09 and before.
My current query looks something like this.
SELECT CPP_Contractors.ID, CPP_Contractors.Contractor, CPP_Contractors.Hire_Date, CPP_Contractors.Expire_Date,
FROM CPP_Contractors
WHERE (((CPP_Contractors.Contractor) Is Null)) OR (((CPP_Contractors.Hire_Date) Is Null)) OR (((CPP_Contractors.Hire_Date)<=Date())) OR (((CPP_Contractors.Hire_Date)=Date()+1)) OR (((CPP_Contractors.Hire_Date)=Date()+2)) OR (((CPP_Contractors.Hire_Date)=Date()+3)) OR (((CPP_Contractors.Hire_Date)=Date()+4)) OR (((CPP_Contractors.Hire_Date)=Date()+5)) OR (((CPP_Contractors.Expire_Date) Is Null)) OR (((CPP_Contractors.Expire_Date)<=Date())) OR (((CPP_Contractors.Expire_Date)=Date()+1)) OR (((CPP_Contractors.Expire_Date)=Date()+2)) OR (((CPP_Contractors.Expire_Date)=Date()+3)) OR (((CPP_Contractors.Expire_Date)=Date()+4)) OR (((CPP_Contractors.Expire_Date)=Date()+5));
Right now sometimes the wrong results is still showing up such as if the date is 05/05/09 and I run the query I would not get a list of records even if the hire date is 05/07/09.
I hope I am making sense.