Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    New England (Connecticut)
    Thanked 0 Times in 0 Posts

    DLOOKUP returning time instead of date

    Hello all, I am really confused with a reult I get in a DLOOKUP function:Both vContCompDateMod and vContCompDatePiin are declared as DatesI get a valid answer for vContCompDateMod = Forms![supmod -> exe]![CONT_COMP_DATE], but I get an "invalid us of null" error with vContCompDatePiin = DLookup("[CONT_COMP_DATE]", "Cams_PIIN_Data1", "[Key] = '" & strHolderPIIN & "'"). then when I go to the debug window and hover over the variable it shows it returning 12:00:00 in a time format... the strHolderPIIN variable of that function returns the proper response of "DNL" and appears to be finding the correct record in the table and the "[CONT_COMP_DATE]" component of the function is a valid field formated as short date with an actual date being displayed in the table... I have tried both "[CONT_COMP_DATE]" and [CONT_COMP_DATE] without the quotes but th result is the same... can anyone tell if I am overlooking something ?

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Evergreen, CO, USA
    Thanked 65 Times in 64 Posts
    The result you see in the debug window is 12:00 noon with a zero day - remember that Access stores all dates with a time component as well. Are you doing this in VBA, or in a query? If it is the former, then I would suggest you build the actual arguments in code and assign them to variable so you can inspect them before you try to execute the DLookup() function. In a query it is harder to debug, but you can build expressions and then use those as the arguments.

Posting Permissions

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