shaz0503
asked on
query to return records where a date field is between now and 3 montsh in the future
All
I need a query to return records where a date field is between now and 3 months in the future. I thought i had the code right but now i playing silly games....
rgds
I need a query to return records where a date field is between now and 3 months in the future. I thought i had the code right but now i playing silly games....
rgds
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
All
Have tried all the above but can't seem to get them to work - keeps saying data type mismatch
this however works...
SELECT EmployeeData.[Employee ID], EmployeeData.[Termination Date]
FROM EmployeeData
WHERE (((EmployeeData.[Terminati on Date])<Now()+90));
but would prefer to be able to add 3 months instead of 90 days if possible
Data in field is set as Date/Time so unsure why a data mismatch
any ideas
Shaz
Have tried all the above but can't seem to get them to work - keeps saying data type mismatch
this however works...
SELECT EmployeeData.[Employee ID], EmployeeData.[Termination Date]
FROM EmployeeData
WHERE (((EmployeeData.[Terminati
but would prefer to be able to add 3 months instead of 90 days if possible
Data in field is set as Date/Time so unsure why a data mismatch
any ideas
Shaz
try this, copy and paste
SELECT EmployeeData.[Employee ID], EmployeeData.[Termination Date]
FROM EmployeeData
WHERE EmployeeData.[Termination Date] between dateserial(Year(Date()),mo nth(date() ), day(date()) and dateserial(Year(Date()),mo nth(date() )+3, day(date())
SELECT EmployeeData.[Employee ID], EmployeeData.[Termination Date]
FROM EmployeeData
WHERE EmployeeData.[Termination Date] between dateserial(Year(Date()),mo
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank you all
finally got it
rgds
shaz
finally got it
rgds
shaz
from table
where [datefield] between Date() and Dateadd("m",3,Date())
or this one
select *
from table
where [datefield] between dateserial(Year(Date()),mo