Not sure I understand, but if you create a function in the code behind a
form, it will only be available to THAT form. If you want the function to
be used globally, you have to put it in a Module.
--
--Roger Carlson
MS Access MVP
Access Database Samples:
www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L
"Kou Vang" <(E-Mail Removed)> wrote in message
news:453B5FEA-D01A-425A-BE72-(E-Mail Removed)...
> I have inserted a function into one of my forms. When I just insert it
into
> a module by itself it works, but not in my form. It is from the compare 2
> times in the Microsoft KB. Does this function need to be in it's own
module
> in order to work? When I try to call it in my form, it says it doesn't
> recognize the sub or function. Thanks!
>
> Option Explicit
>
> Function ElapsedTTime(Interval)
> Dim x
> x = Int(CSng(Interval * 24 * 3600)) & " Seconds"
> Debug.Print x
> x = Int(CSng(Interval * 24 * 60)) & ":" & Format(Interval, "ss") _
> & " Minutes:Seconds"
> Debug.Print x
> x = Int(CSng(Interval * 24)) & ":" & Format(Interval, "nn:ss") _
> & " Hours:Minutes:Seconds"
> Debug.Print x
> x = Int(CSng(Interval)) & " days " & Format(Interval, "hh") _
> & " Hours " & Format(Interval, "nn") & " Minutes " & _
> Format(Interval, "ss") & " Seconds"
> Debug.Print x
>
> End Function