A
AL Rennie
From Excel, I'm importing External data from a database
table or Query. I have a VB module in Access that is
utilized to convert joulian dates to Proper dates in my
query. The query itself runs fine but evidently any query
in which this funtion is utilized does not show up as a
Database source. I'm receiving an error "Undefined
function in expression" in Excel. Is there a way to define
the function in my module?
Here is the Module:
Option Compare Database
Option Explicit
Declare Function DecodeTextAttachments
Lib "e:\mike\debug\mike.dll" (ByVal lpBuffer As String,
Flag As String) As Long
Declare Sub PromptTraceFlags
Lib "e:\trace\debug\trace.dll" (ByVal Window As Integer,
ByVal Flags As Integer)
Declare Sub PromptNotes Lib "e:\trace\debug\trace.dll"
(ByVal Window As Integer, ByVal Flags As Integer)
Public Function getval(InVal As Variant) As Long
If IsNull(InVal) Then
getval = 0
Else
getval = InVal
End If
End Function
Public Function JoulianToDate(Joulian As Long) As Date
Dim year As Integer
Dim day As Integer
Dim month As Integer
Dim MyDate As Date
MyDate = #1/1/1900#
MyDate = DateAdd("yyyy", Joulian / 1000, MyDate)
MyDate = DateAdd("d", Joulian Mod 1000 - 1, MyDate)
JoulianToDate = MyDate
End Function
Public Function DateToJoulian(InDate As Date) As Long
Dim year As Integer
Dim day As Integer
Dim month As Integer
Dim MyDate As Date
DateToJoulian = DatePart("y", InDate) + ((DatePart
("yyyy", InDate) - 1900) * 1000)
End Function
Public Function DeltaTime(StartT As Date, EndT As Date) As
String
Dim Hour As Integer
Dim Minute As Integer
Dim Second As Integer
Hour = DateDiff("h", StartT, EndT)
Minute = DateDiff("n", StartT, EndT)
Second = DateDiff("s", StartT, EndT)
If Minute > 0 Then
Second = Abs(Second - (Minute * 60))
End If
If Hour > 0 Then
Minute = Abs(Minute - (Hour * 60))
End If
DeltaTime = Str(Hour) + ":" + Str(Minute) + ":" + Str
(Second)
End Function
Regards,
AL Rennie
table or Query. I have a VB module in Access that is
utilized to convert joulian dates to Proper dates in my
query. The query itself runs fine but evidently any query
in which this funtion is utilized does not show up as a
Database source. I'm receiving an error "Undefined
function in expression" in Excel. Is there a way to define
the function in my module?
Here is the Module:
Option Compare Database
Option Explicit
Declare Function DecodeTextAttachments
Lib "e:\mike\debug\mike.dll" (ByVal lpBuffer As String,
Flag As String) As Long
Declare Sub PromptTraceFlags
Lib "e:\trace\debug\trace.dll" (ByVal Window As Integer,
ByVal Flags As Integer)
Declare Sub PromptNotes Lib "e:\trace\debug\trace.dll"
(ByVal Window As Integer, ByVal Flags As Integer)
Public Function getval(InVal As Variant) As Long
If IsNull(InVal) Then
getval = 0
Else
getval = InVal
End If
End Function
Public Function JoulianToDate(Joulian As Long) As Date
Dim year As Integer
Dim day As Integer
Dim month As Integer
Dim MyDate As Date
MyDate = #1/1/1900#
MyDate = DateAdd("yyyy", Joulian / 1000, MyDate)
MyDate = DateAdd("d", Joulian Mod 1000 - 1, MyDate)
JoulianToDate = MyDate
End Function
Public Function DateToJoulian(InDate As Date) As Long
Dim year As Integer
Dim day As Integer
Dim month As Integer
Dim MyDate As Date
DateToJoulian = DatePart("y", InDate) + ((DatePart
("yyyy", InDate) - 1900) * 1000)
End Function
Public Function DeltaTime(StartT As Date, EndT As Date) As
String
Dim Hour As Integer
Dim Minute As Integer
Dim Second As Integer
Hour = DateDiff("h", StartT, EndT)
Minute = DateDiff("n", StartT, EndT)
Second = DateDiff("s", StartT, EndT)
If Minute > 0 Then
Second = Abs(Second - (Minute * 60))
End If
If Hour > 0 Then
Minute = Abs(Minute - (Hour * 60))
End If
DeltaTime = Str(Hour) + ":" + Str(Minute) + ":" + Str
(Second)
End Function
Regards,
AL Rennie