R
Robert_DubYa
I have a module I created and when used in a query it runs fine as long as I
do not set criteria against that field. The moment I set criteria against
the the field I get a "Type Mismatch error". The table is huge. 1M records.
I need to find where the mismatch is in order to get this query work
correctly.
I created a simple module to convert a date/time stored as a number from
another db to be used as normal date time data type. The number I'm
converting looks like:
200809260730
The first four numbers are the year, 5th and 6th the month, the 8th and 9th
the day, 10th and 11th the hour and the last two are the minutes. The
converted date/time is:
9/26/2008 7:30am
My module to convert is simple:
Option Compare Database
Option Explicit
Function ConvertKronos(KronosDate As Double)
On Error GoTo Err_Kronos
If KronosDate = 0 Then
ConvertKronos = 0
Else
ConvertKronos = CDate(Mid(KronosDate, 5, 2) & "/" &
Mid(KronosDate, 7, 2) & "/" & Left(KronosDate, 4) _ '****this line is
overflow and is part of the above
& " " & Mid(KronosDate, 9, 2) & ":" & Mid(KronosDate, 11, 2) &
":" & Mid(KronosDate, 13, 2)) '****this line is overflow and is part of the
above
End If
Exit_Kronos:
Exit Function
Err_Kronos:
MsgBox Err.Description
Resume Exit_Kronos
End Function
If you know why my error is occuring or if you could help in anyway I would
be greatful.
thanks,
Robert
do not set criteria against that field. The moment I set criteria against
the the field I get a "Type Mismatch error". The table is huge. 1M records.
I need to find where the mismatch is in order to get this query work
correctly.
I created a simple module to convert a date/time stored as a number from
another db to be used as normal date time data type. The number I'm
converting looks like:
200809260730
The first four numbers are the year, 5th and 6th the month, the 8th and 9th
the day, 10th and 11th the hour and the last two are the minutes. The
converted date/time is:
9/26/2008 7:30am
My module to convert is simple:
Option Compare Database
Option Explicit
Function ConvertKronos(KronosDate As Double)
On Error GoTo Err_Kronos
If KronosDate = 0 Then
ConvertKronos = 0
Else
ConvertKronos = CDate(Mid(KronosDate, 5, 2) & "/" &
Mid(KronosDate, 7, 2) & "/" & Left(KronosDate, 4) _ '****this line is
overflow and is part of the above
& " " & Mid(KronosDate, 9, 2) & ":" & Mid(KronosDate, 11, 2) &
":" & Mid(KronosDate, 13, 2)) '****this line is overflow and is part of the
above
End If
Exit_Kronos:
Exit Function
Err_Kronos:
MsgBox Err.Description
Resume Exit_Kronos
End Function
If you know why my error is occuring or if you could help in anyway I would
be greatful.
thanks,
Robert