Results 1 to 3 of 3

Thread: DLookup? (A2K)

  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DLookup? (A2K)

    Good Morning,

    I have an unusual situation (or to me it is).

    I have a very small form that ONLY captures the UserLogin and once they hit a button, records the date and time and closes.

    I need it to do one other thing, I need it to do a DLookup for the PayPeriod.

    I have a table that holds:
    PayPeriod--What Pay Period The StartCycle and EndCycle is
    StartCycle--StartDate of PayPeriod
    EndCycel--EndDate of PayPeriod

    So....As the user clicks the button, the DATE is recorded, I need somehow to look up that DATE and determine what PayPeriod that DATE falls in (using the StartCycle and EndCycle).

    I thought a DLOOKUP would be best:

    Code:
    --------------------------------------------------------------------------------

    =DLookUp("[PayPeriod]","tPayPeriod","[>>>>] =" & Forms!fTimeCard!>>>)
    --------------------------------------------------------------------------------


    but get lost where the ">>>>" fall.

    Can someone point me in the right direction?

    Thanks in advance.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DLookup? (A2K)

    Good afternoon,

    Is DATE the current date/time? If so, try

    =DLookUp("[PayPeriod]","tPayPeriod","Date() Between [StartCycle] And [EndCycle]")

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: DLookup? (A2K)

    What about this?


    =DLookUp("[PayPeriod]","tPayPeriod","([StartCycle] <=" & Date & ") and ( [EndCyce] >=" & Date & ")")

    * You could get the date from the form, or just use the Date function again.
    * The correct one will have a StartCycle less than or equal to current date, and EndCycle greater than or equal to current date.

    This assumes you use mm/dd/yyyy date formats. Otherwise you would need to convert to them.
    Regards
    John



Posting Permissions

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