Results 1 to 3 of 3
  1. #1
    Bkper087 is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    May 2014
    Posts
    81

    Dlookup with dyamic "between" criteria stored in table

    Is it possible to reference a table to check if a value is between two numbers and return a related field? I am using Dlookup, but I’m not sure what would go in the criteria field. I tried just using a relationship, but I cant figure out a way to make it work.

    Here is an overview of related info:


    I would like to display different messages based on a number. This number represents the days that have passed since the record was created. This number is currently in the query: qryClients

    I have also created a table: tblMessages that has the fields ID, Message, DaysAging. This table stores the message I would like to have appear based on the number of dates that have passed.

    I would assume that Dlookup would be best for this function, but since it would not be an exact match but rather a between type function, I’m not sure what that would look like. Any help would be appreciated.

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Can you give examples of what you are expecting and what the table contains for Days?

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Dlookup is for forms.
    queries use joins on tables.

    the query can find items if the table has a min and max

    msg, min, max
    low, 0, 10
    med, 11, 20
    hi, 21, 50

    youd place your lookup table in the query ,NO JOINS, and criteria would as [field]>=tLookup.min and [field]<= tLookup.max

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

Similar Threads

  1. Replies: 2
    Last Post: 09-24-2016, 11:29 PM
  2. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  3. Replies: 1
    Last Post: 06-21-2014, 04:46 PM
  4. Replies: 13
    Last Post: 01-30-2013, 03:05 PM
  5. ComboBox "Select" and "DLookUp"
    By witooldas in forum Forms
    Replies: 0
    Last Post: 03-23-2011, 03:31 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