• DLOOKUP returning time instead of date

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » DLOOKUP returning time instead of date

    • This topic has 1 reply, 2 voices, and was last updated 10 years ago.
    Author
    Topic
    #499630

    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 ?

    Viewing 0 reply threads
    Author
    Replies
    • #1501140

      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.

    Viewing 0 reply threads
    Reply To: DLOOKUP returning time instead of date

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: