Results 1 to 2 of 2
  1. #1
    wtucker is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Jun 2017
    Posts
    50

    Question Multi-table Lookup based on Date Range

    Hey guys,

    I've got a tricky situation. I know how it all fits together, but I can't figure out the specifics. Any help is greatly appreciated!

    Here are the tables:

    Claims:
    ClaimID (PK)


    GroupNumber
    ServiceDate
    ClientName

    Quotes:
    QuoteID (PK)
    Group Number
    StartDate
    EndDate
    Carrier

    I'm trying to look up what the Carrier is for a given GroupNumber during a given ServiceDate.


    -For a single GroupNumber there are multiple quotes and multiple claims.
    -A Quote is an annual period of coverage. So the Start and End dates could be 1/1/2018 and 12/31/2018, or 6/15/2017 and 5/14/2018.
    -There is only one Quote per GroupNumber per StartDate, and StartDates do not overlap. They are sequential periods.
    -A ServiceDate is a date within the Quote Start and End dates.

    I don't know if I need a lookup table, or if I can just write a SQL query.
    I've been trying to create a Calculated Control on a form that's based on the Claims table to show the carrier.

    This is what I have so far. I know it's still pretty far off.
    Code:
    =DLOOKUP("[Quotes]![Carrier]","[Quotes]","[frmClaims]![GroupNumber]=[Quotes]![GroupNumber] and [frmClaims]![ServiceDate] between [Quotes]![StartDate] and [Quotes]![EndDate]")

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    Can you try:

    =DLOOKUP("[Carrier]","[Quotes]","[GroupNumber]=" & frmClaims.[GroupNumber] " AND [StartDate] <= #" & frmClaims![StartDate] & "# AND [EndDate]>= #" & frmClaims![EndDate] & "#")

    Cheers,
    Vlad

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query Criteria Lookup Date Range from Table
    By cirix20 in forum Queries
    Replies: 3
    Last Post: 03-03-2018, 03:31 PM
  2. Replies: 1
    Last Post: 10-09-2017, 11:36 AM
  3. Replies: 4
    Last Post: 04-25-2015, 04:17 PM
  4. Lookup of result based on 1 value compared to range.
    By Scorpio11 in forum Database Design
    Replies: 4
    Last Post: 04-11-2012, 02:30 PM
  5. Replies: 1
    Last Post: 06-17-2011, 12:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums