Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Dec 2008
    New Orleans, Louisiana, USA
    Thanked 0 Times in 0 Posts
    I have a program at work that I use in MS Access. We recently upgraded to 2007 from 2003 but I'm not sure if this is causing my problem. I have run this query since the upgrade and only yesterday started seeing this problem. I run the form and when it produces results, a debug screen appears with the following info:

    the line " If (DateFormat = 1) And (Trim(x) <> " ") Then" is where the debugger stops.

    ' First Release of this function returns a date which comes in as yyyymmdd (DateFormat=1)
    ' and returns in either MM/DD or MM/DD/YY or MM/DD/YYYY, depending on the StrLen passed in.
    ' 23.7 - Changed Input Parameter 'x' from a String to Variant Data Type so Null Values will not
    ' cause a Data Type Mismatch error.
    ' - Added 'Not IsNull' check so no formatting will be done for a Null value. If Null, it will
    ' just return and empty string.
    Dim tempdate As String
    tempdate = ""

    If Not IsNull(x) Then
    If (DateFormat = 1) And (Trim(x) <> " ") Then
    tempdate = Mid(x, 5, 2) & "/" & Mid(x, 7, 2) & "/" & IIf(StrLen = 10, Mid(x, 1, 4), Mid(x, 3, 2))
    tempdate = Left(tempdate, StrLen)
    End If
    End If

    ConvDate = tempdate
    End Function

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Cambridge, UK
    Thanked 3 Times in 3 Posts
    Can you post the full function,
    and an example call to it with example input parameters.
    Also what is the debugger message.

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Evergreen, CO, USA
    Thanked 58 Times in 58 Posts
    Doing as Andrew suggests would help a great deal - but my guess is you have some garbage data being passed in that connot be formatted as a date. In the debugger you should be able to print the value of x and see what the data looks like. That function should work just fine in 2007.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts