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!

Query Updating the Wrong Thing!! 1

Status
Not open for further replies.

quest4

Technical User
Aug 27, 2001
735
US
I have a select query, that works with a function and I don't understand why I am getting the results I am. This is a section of the query that has the problem:

IIf([JuryVacCount]>2,(GetNumWeeks()+1))
FROM tblEmployees AS Emp LEFT JOIN tblAttendance AS Att
ON Emp.EmployeeNumber=Att.EmployeeNumber
WHERE (Emp.EmpStatusType="Active"
And Emp.PayType="per Hour")
And (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()))))

This is the function:

Function GetNumWeeks(Optional num As Integer)
If num = 0 Then
GetNumWeeks = 13
Else
GetNumWeeks = num
End If
End Function
What it is supposed to do is increase the Function variable from 13 to 14. What it is doing is at the end of the row, where JuryVacCount>2, it put a 14 in a new column. Could someone please tell me what is wrong with my query and/or function? Also how to reset the GetNumWeeks() by to the default when a new employee number comes along. I am ready to pull my hair out with this one. I am inches away from finishing this database and this is the only thing holding me back, so thank you very much in advance to anyone who comes up with the answer.
 
It is a zipped and ready to go. Where do you want it e-mailed? Thanks.
 

tlbroadbent@hotmail.com Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Terry, I will get you that database as soon as our e-amil goes back on line. It decided to die. Thanks again.
 
We are back on line, I think, and the dbase has been sent, think. Please let me know if you don't get it. Thanks again for everything.
 

I haven't received the file, yet. Hotmail limits the size of attachments. You may need to send the file to another address. Send me a message to the Hotmail account and I'll give you an alternate Email address. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
I just got a work around for all of our trouble we are haveing with the e-mail server. I opened a e-mail account at yahoo.com and have send your the d-base. The e-mail is titled The D-Base. Please let me know if that doesn't work. The file is less than 1.5 Mg in size. Thanks again.
 

1.5 MB is probably too big for Hotmail. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top