Custom Function In Query Not Working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Access 2002. I want to create a function that can be used in a
query. The name of the function is 'TimeCode'. Whenever I try to run the
query, I get an error saying "Undefined Function 'Timecode' in expression".

My function is a standard module:
Public Function TimeCode(intBits As Integer) As String

Dim MediaFrameRate As Integer
Dim Frames As Integer

MediaFrameRate = 10160640000#
Frames = intBits / MediaRate

TimeCode = (Int(Frames / 90000)) * _
1000000 + (Int(Frames / 1500) - (Int(Frames / 90000)) * 60) _
* 10000 + (Int(Frames / 25) - ((Int(Frames / 90000)) * 3600) - _
(Int(Frames / 1500) - Int(Frames / 90000) * 60) * 60) _
* 100 + (Frames - (Int(Frames / 25) _
* 25))

End Function


My query is this:
SELECT TimeCode(ClipLoggingInfo!MediaInPoint) AS Expr1
FROM ClipLoggingInfo;

Any help would be much appreciated.
 
That's the problem!

Functions and modules share the same name space and using the same name will
create problems. I always name them differently. For example, most of my
functions have the prefix "fn" and Standard Modules have prefix "vba".
 
Back
Top