Results 1 to 4 of 4
  1. #1
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60

    dlook up and setfocus

    Copy.mdb
    Please see my program
    It has 3 forms:
    1- calc


    2-endcalc
    3-endcalcsub
    and 1 table: cmp

    I want enter a number in calc form textbox, example: 2, when I click on calc button it opens endcalc and focuses on "2.07" cell which is more than 2.
    if I enter 4.5 it focuses on "4.81" cell in endcalc form
    please help me, thanks

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You're making this way more complex than it needs to be I think.

    You just want to find the first value in your table AFTER the number entered in a text field, you don't really care about all the other values, right?

    So in other words, for your example, if you put in 2, you'd only want the record with 2.07 to appear?

  3. #3
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by rpeare View Post
    You're making this way more complex than it needs to be I think.

    You just want to find the first value in your table AFTER the number entered in a text field, you don't really care about all the other values, right?

    So in other words, for your example, if you put in 2, you'd only want the record with 2.07 to appear?
    yes, that's right. how to do that?

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Copy.zip

    note the use of a query using the TOP clause to return the first value AFTER the number chosen.

    You can just as easily build the form on a SQL statement I just broke it out so it's easier to see.

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

Similar Threads

  1. SetFocus after MsgBox
    By NISMOJim in forum Programming
    Replies: 18
    Last Post: 12-12-2012, 08:44 PM
  2. Dlook Up
    By cap.zadi in forum Forms
    Replies: 4
    Last Post: 12-26-2011, 12:20 PM
  3. simple SetFocus
    By markjkubicki in forum Forms
    Replies: 5
    Last Post: 10-04-2011, 11:47 AM
  4. setfocus on an textbox different way
    By white_flag in forum Access
    Replies: 0
    Last Post: 09-21-2011, 05:04 AM
  5. SetFocus Issue
    By Sinjin in forum Access
    Replies: 0
    Last Post: 02-14-2008, 07: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