Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Hi, I'm having some endless issue trying to get the dlookup to insert the value from a "date/time-short date" data type field into a new control. I have different calculations I cant change the data type to text. I tried to change it and "errors" kept coming up in the form's fields

    First code attempt,

    Me.cobPayEndDate = DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = " & Chr (34) & Me.cobPayStartDate & Chr (34))

    Second code attempt,

    Me.cobPayEndDate = DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = " & Forms!frmCostPointExport!cobPayStartDate)

    Any help is welcome!

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts
    [quote name='Lastcall' post='799391' date='22-Oct-2009 18:13']Hi, I'm having some endless issue trying to get the dlookup to insert the value from a "date/time-short date" data type field into a new control. I have different calculations I cant change the data type to text. I tried to change it and "errors" kept coming up in the form's fields

    First code attempt,

    Me.cobPayEndDate = DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = " & Chr (34) & Me.cobPayStartDate & Chr (34))

    Second code attempt,

    Me.cobPayEndDate = DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = " & Forms!frmCostPointExport!cobPayStartDate)

    Any help is welcome![/quote]

    You could try

    Me.cobPayEndDate = DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = #" & format(Me.cobPayStartDate,"mm/dd/yy") & "#")

    You might also like to add the Line below before the Assignment to see what it is trying to insert
    Delete it once it functions OK

    MsgBox DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = #" & format(Me.cobPayStartDate,"mm/dd/yy") & "#")
    Andrew

  3. #3
    2 Star Lounger
    Join Date
    Jul 2005
    Location
    North Carolina, USA
    Posts
    195
    Thanks
    4
    Thanked 0 Times in 0 Posts
    [quote name='AndrewKKWalker' post='799403' date='22-Oct-2009 20:06']You could try

    Me.cobPayEndDate = DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = #" & format(Me.cobPayStartDate,"mm/dd/yy") & "#")

    You might also like to add the Line below before the Assignment to see what it is trying to insert
    Delete it once it functions OK

    MsgBox DLookup("[PayEndDate]", "tblDataPayPeriod", "[PayStartDate] = #" & format(Me.cobPayStartDate,"mm/dd/yy") & "#")[/quote]


    Thank you so much! Andrew that really solved my problems..whoo hooo!

Posting Permissions

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