Greetings.
In this query called qryMainList, I am trying to create the criteria on the Equipment_Name field requiring the date difference between today's date and the field called NextDueDate (that I just calculated within the same query) be less than 1/10 of the Interval field. NextDueDate shows as expected in a table, but I am having trouble referencing it in the criteria for Equipment_Name. Here are the different outcomes depending on how I tried to input NextDueDate in DateDiff():
DateDiff("y", NextDueDate, Date() ) < (0.1 * [Task_List].[Interval]) - NextDueDate automatically gets converted to a string as you can see underlined below, giving an error on datasheet view for incorrect parameter type.
DateDiff("y", [NextDueDate], Date() ) < (0.1 * [Task_List].[Interval]) or DateDiff("y", [qryMainList].[NextDueDate], Date() ) < (0.1 * [Task_List].[Interval]) - Entering datasheet view will prompt me for the value of NextDueDate or qryMainList.NextDueDate, as can be seen below.
Do I need to make NextDueDate part of a table? I would prefer to keep it a field within this query. Should I just embed the expression for NextDueDate within DateDiff and not reference another field? *Update: This worked, though it would look cleaner if I referenced NextDueDate but certainly not needed for my purposes.
Thanks.
In this query called qryMainList, I am trying to create the criteria on the Equipment_Name field requiring the date difference between today's date and the field called NextDueDate (that I just calculated within the same query) be less than 1/10 of the Interval field. NextDueDate shows as expected in a table, but I am having trouble referencing it in the criteria for Equipment_Name. Here are the different outcomes depending on how I tried to input NextDueDate in DateDiff():
DateDiff("y", NextDueDate, Date() ) < (0.1 * [Task_List].[Interval]) - NextDueDate automatically gets converted to a string as you can see underlined below, giving an error on datasheet view for incorrect parameter type.
DateDiff("y", [NextDueDate], Date() ) < (0.1 * [Task_List].[Interval]) or DateDiff("y", [qryMainList].[NextDueDate], Date() ) < (0.1 * [Task_List].[Interval]) - Entering datasheet view will prompt me for the value of NextDueDate or qryMainList.NextDueDate, as can be seen below.
Do I need to make NextDueDate part of a table? I would prefer to keep it a field within this query. Should I just embed the expression for NextDueDate within DateDiff and not reference another field? *Update: This worked, though it would look cleaner if I referenced NextDueDate but certainly not needed for my purposes.
Thanks.
Last edited: