I have a select query in which the old version works fine, but in the new version I added a variable thru a function. The new version returns no data at all and the old version returns the correct two employees. Also, I don't think that the new version is picking up the defaults the way the old version did. Here is the old line of code that works:
(Att.DateWeekStarting Between Nz([Enter Start Date],DateAdd("ww",[RptDur],Date()))
And Dateadd("ww",(([RptDur]*-1)-1),Nz([Enter Start Date],DateAdd("ww",[RptDur],Date()))))
Both are the WHERE clause, if it matters. Here is the new version, that does not work:
(Att.DateWeekStarting Between Nz([Enter Start Date], DateAdd("ww",-1-GetNumWeeks(), Date()))
And Dateadd("ww",[Enter the Period], Nz(GetNumWeeks(), DateAdd("ww",-1-GetNumWeeks(), Date()))))
And the function the works with it is as follows:
Function GetNumWeeks()As Integer
GetNumWeeks=13
End Function
Can anyone see what is wrong with the new version? Very simply, the query is to bring up a pop-up window to enter the starting date, with a default of todays date minus 7 days, and then set the ending date to 13 weeks less than the starting daye. Thanks alot for any help rendered.
(Att.DateWeekStarting Between Nz([Enter Start Date],DateAdd("ww",[RptDur],Date()))
And Dateadd("ww",(([RptDur]*-1)-1),Nz([Enter Start Date],DateAdd("ww",[RptDur],Date()))))
Both are the WHERE clause, if it matters. Here is the new version, that does not work:
(Att.DateWeekStarting Between Nz([Enter Start Date], DateAdd("ww",-1-GetNumWeeks(), Date()))
And Dateadd("ww",[Enter the Period], Nz(GetNumWeeks(), DateAdd("ww",-1-GetNumWeeks(), Date()))))
And the function the works with it is as follows:
Function GetNumWeeks()As Integer
GetNumWeeks=13
End Function
Can anyone see what is wrong with the new version? Very simply, the query is to bring up a pop-up window to enter the starting date, with a default of todays date minus 7 days, and then set the ending date to 13 weeks less than the starting daye. Thanks alot for any help rendered.