Searching date formats !

  • Thread starter Thread starter PER HILDAL
  • Start date Start date
P

PER HILDAL

Hello !

In MS Access you need to use US date format to search date in sql
expressions
this is fearly understandable but why is my qury expression so slow do
anyone have a tuning tip to this code ! :-)
I tried defining Fra and til as date but that doesent work in the expression


Public Function ID_Booking(Fra_StKa As Date, Til_StKa As Date)
On Error GoTo Error_ID_Booking
Dim Criteria As String
Dim Fra as Variant , Til as Variant

Fra = "#" & Format(Fra_StKa, "mm-dd-yyyy Hh:nn:ss") & "#"
Til = "#" & Format(Fra_StKa, "mm-dd-yyyy Hh:nn:ss") & "#"

ID_Booking = DLookup("[ID_FaPo]", "Table_Name", "[Fra_FaPo] <=" & Fra & "
And " & "[Til_FaPo] >" & Til)

Exit Function
Error_ID_Booking:
MsgBox Err.Description
End Function

Thanks for any reply

PSH
 
In general, the Domain functions DLookup, DSum etc execute
very slowly. Try rewritting the function to use a DAO or
ADO Recordset and SQL to see if there is an improvement in
response.

Hope This Helps
Gerald Stanley MCSD
 
Back
Top