dlookup in form that returns the closest value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ccoldfire
    New Member
    • Feb 2016
    • 3

    dlookup in form that returns the closest value

    hi to yo all
    lets say we have this table

    tbl_city
    ID ------- city
    10 ------- london
    20 ------- barcelona
    30 ------- paris

    and a form that consist of two text box(txt1,txt2), in the first one i enter a number and the other one contains a dlookup function that will run that number against tbl_city and will return the city name which its ID is the closest to the one i entered.

    for example,if i enter 19 in txt1 i will get barcelona in txt2 and so on.
    so,is that possible????
    thank you in advance
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    See the solution from This Thread. Just create a query and then use the DLookup without any criteria so that it will get the first record.

    Comment

    Working...