Hi, all--
It's been a while but I'm having a basic problem in Access 2007 when calling a function in a query expression.
The function is as follows:
Option Compare Database
Public Function ddhhnn_diff(dtein As Date, dteout As Date) As String
're: http://www.access-programmers.co.uk/forums/showthread.php?t=183059
'*******************************************
'Purpose: Returns DateDiff as dd:hh:nn
'Coded by: raskew
'Input: From debug (immediate) window:
' 1) ? ddhhnn_diff(#01/01/2009 12:30:00#, #01/02/2009 16:36:30#))
'Output: 1) 01:04:06
'*******************************************
Dim x As Integer
x = DateDiff("n", dtein, dteout)
ddhhnn_diff = Format(x \ 1440, "00") & ":" & Format((x Mod 1440) \ 60, "00") & ":" & Format(x Mod 60, "00")
End Function
I call it in the following query expression: ddhhnn_diff([DateTime_1], [DateTime_2]).
I get the "Undefined Function" error when I run the query.
What have I forgotten (besides alot)?
Thanks.
Paul
It's been a while but I'm having a basic problem in Access 2007 when calling a function in a query expression.
The function is as follows:
Option Compare Database
Public Function ddhhnn_diff(dtein As Date, dteout As Date) As String
're: http://www.access-programmers.co.uk/forums/showthread.php?t=183059
'*******************************************
'Purpose: Returns DateDiff as dd:hh:nn
'Coded by: raskew
'Input: From debug (immediate) window:
' 1) ? ddhhnn_diff(#01/01/2009 12:30:00#, #01/02/2009 16:36:30#))
'Output: 1) 01:04:06
'*******************************************
Dim x As Integer
x = DateDiff("n", dtein, dteout)
ddhhnn_diff = Format(x \ 1440, "00") & ":" & Format((x Mod 1440) \ 60, "00") & ":" & Format(x Mod 60, "00")
End Function
I call it in the following query expression: ddhhnn_diff([DateTime_1], [DateTime_2]).
I get the "Undefined Function" error when I run the query.
What have I forgotten (besides alot)?
Thanks.
Paul