Results 1 to 5 of 5
  1. #1
    Whit is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2018
    Posts
    7

    Highighting specific record in a sub-form

    I have a sub-form populated by a table. I want to go to a specific record in the table and have it highlighted in the sub-form. I sequentially read the file in a loop until I get to the record I want. I know I have just read the desired record as I have a watch set showing me the record id. But in the sub-form, the first record in the table is highlighted, not the one I just read. What do I need to do to highlight the record that was just read? I did a subform.requery, but that didn't work.

    Thanks



    Whit

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    is this a continuous form? If yes, easier to point you here https://answers.microsoft.com/en-us/...9-e068debcab84

    See the Marshall post.

    You could also try conditional formatting on all of the record fields, which someone may elaborate on here, but you might have a lot of fields in a row.
    Last edited by Micron; 07-02-2018 at 06:48 PM. Reason: added info
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Whit is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Apr 2018
    Posts
    7
    No. It is not a continuous form.
    I just assumed that whatever was the current record based on the code reading the table would be highlighted just as if the user had clicked on that record.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Then I guess it's a datasheet view. I guess I should have been very explicit about what I wanted to know, or at least should have covered all the bases.
    Then it seems you'll want to use conditional formatting for all the controls in your detail section. Since you are able to ascertain the record id, you should be able to have the added textbox (per the link I provided) be updated via code to be either of 2 values (e.g. 1 for being the selected record, 0 for not) and the cf condition being that the background is a different color when the condition is 1.

    Also more example(s) here and other Google results (starting with post 6)
    https://www.access-programmers.co.uk...d.php?t=294753

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,016
    Quote Originally Posted by Whit View Post

    ...I sequentially read the file in a loop until I get to the record I want. I know I have just read the desired record as I have a watch set showing me the record id...
    Not sure exactly what you mean by the above, in red, but if you mean that the desired Record is the Current Record, you might try, after the line that 'finds' the desired Record

    RunCommand acCmdSelectRecord

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 3
    Last Post: 11-28-2016, 03:17 PM
  2. Replies: 2
    Last Post: 01-14-2015, 12:00 PM
  3. Go to specific record on another form
    By gg80 in forum Programming
    Replies: 4
    Last Post: 05-24-2014, 07:02 PM
  4. Go To Specific Record on Form
    By burrina in forum Forms
    Replies: 4
    Last Post: 12-26-2012, 07:15 PM
  5. Help with opening form to specific record
    By manic in forum Programming
    Replies: 7
    Last Post: 09-18-2012, 08:44 PM

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