Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Increase And Reset A Function Value?? 1

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
I have a query, which uses a function, GetNumWeeks(), but how do I add 1 to the value of GetNumWeeks(), increasing its' value from 13 to 14? Then how do I reset it to the default value, which is 13, when the next EmployeeNumber comes-up? I tried this:

IIf([JuryVacCount]>2,(GetNumWeeks()+1))

I got a new column, with the number 14 in it, instead of 14 rows of data, I did get the 13 rows, though. Thanks you again for any help, when this finished I am done with this quert and I am of to test land. Here is the function:

Function GetNumWeeks()
GetNumWeeks = 13
End Function
 
How about

FunctiongetNumWeeks(Optional num As Integer)

if num=0 then
getNumWeeks=13
else
getNumWeeks = num
end if


End Function
 
Thank you for the quick response. I made the changes to the fuction, and I got exactly the same results. Only 13 weeks of data and a column with the number 14 in it. Here is the part of the query that sets the start and end dates and uses the GetNumWeeks():
(Att.DateWeekStarting Between Nz([Enter Start Date],
DateAdd("ww",-1-GetNumWeeks(),Date()))
And Dateadd("ww",GetNumWeeks(),Nz([Enter Start Date],
DateAdd("ww",-1-GetNumWeeks(),Date())))

Could this be where I am screwing up? Thanks again for the response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top