Importing external Data

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
 
B

BrianB

As you are using VB anyway I suggest you make a table with the date as a
value, rather than referring to the function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top