Update Function

mkelly

Registered User.
Local time
Today, 07:33
Joined
Apr 10, 2002
Messages
213
Help with function code please!!!!!

What am I doing wrong here? :confused:

Function dup1()
IIf ([Report_Operator production report]![Work Type] = "Dup-1")
End If
dup -1 <= 0
Else
Int(Sum([job completed time]-[job start time]-CDate("0:0:" & DatePart("s",[job completed time]-[job start time]))))*24+DatePart("h",Sum([job completed time]-[job start time]-CDate("0:0:" & DatePart("s",[job completed time]-[job start time])))) & Format(Sum([job completed time]-[job start time]-CDate("0:0:" & DatePart("s",[job completed time]-[job start time]))),":nn")



End Function
 
function purpose not clear

I don't see what you plan to do but this gives no error:

Function dup1()
If ([Report_Operator production report]![Work Type] = "Dup-1") Then
dup -1 <= 0
Else
dup1 = Int(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) * 24 + DatePart("h", Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) & Format(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time]))), ":nn")
End If
 
kissinger said:
I don't see what you plan to do but this gives no error:

Function dup1()
If ([Report_Operator production report]![Work Type] = "Dup-1") Then
dup -1 <= 0
Else
dup1 = Int(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) * 24 + DatePart("h", Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) & Format(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time]))), ":nn")
End If


It keeps giving me an error. I have a table with multiple [work types] dup-1, dup-2 etc. I want to pull only the jobs that are Dup-1 then run the Inc calculation on it to get the total time spent on all the jobs.
 
What is "dup -1 <= 0" supposed to accomplish? If its just a typo, try this.
I don't see any reference to something named "dup".

Function dup1()
If ([Report_Operator production report]![Work Type] = "Dup-1") Then
dup1 = Int(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) * 24 + DatePart("h", Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) & Format(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time]))), ":nn")
else
dup1 = 0
End If
 
billyr said:
What is "dup -1 <= 0" supposed to accomplish? If its just a typo, try this.
I don't see any reference to something named "dup".

Function dup1()
If ([Report_Operator production report]![Work Type] = "Dup-1") Then
dup1 = Int(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) * 24 + DatePart("h", Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time])))) & Format(Sum([job completed time] - [job start time] - CDate("0:0:" & DatePart("s", [job completed time] - [job start time]))), ":nn")
else
dup1 = 0
End If

attached is the database what I am trying to do is get it to run when the report "operator production report" is opened and put the total hours next to the box with total dup-1 jobs worked I put it in the report code but cannot get it to work.
 
mkelly said:
attached is the database what I am trying to do is get it to run when the report "operator production report" is opened and put the total hours next to the box with total dup-1 jobs worked I put it in the report code but cannot get it to work.


Sorry it was to big and would not attach
 

Attachments

I've made the update query for you - can't quite make out what the calcualtion is meant to be.

Also, consider splitting the employees' names into forename and surname.


P.S. Check out my signature ;)
 

Attachments

Mile-O-Phile said:
I've made the update query for you - can't quite make out what the calcualtion is meant to be.

Also, consider splitting the employees' names into forename and surname.


P.S. Check out my signature ;)


Thanks for the help and I understand how it will differentiate the dup-1's but how can I calculate the total times of those dup-1's and insert it in a text box on the report?
 
mkelly, check the attached sample1a. I threw out the function and created a subquery (summary type). In the format event for employee name, I set text97 to a dlookup result from the subquery. If the looked up value needs additional formating or calculations, set a variable equal to the lookup result and set text97 equal to the manipulated result. You can use the same subquery for each each employee/work type. I hope this helps. By the way, it is a very bad idea to use spaces and "-", or the like, in the name of any object. Damn, with the addition of the query, the sample is now too big to attach. Can you send me a private msg with an email address where I can send the sample?
 

Users who are viewing this thread

Back
Top Bottom