Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Remster is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2010
    Posts
    317

    Get the record number for a non-current record from the scrollbar screentip

    Is there any way to get the record number for a non-current record from the scrollbar screentip, e.g. 317 in the attached image?

    Click image for larger version. 

Name:	Untitled.png 
Views:	26 
Size:	4.8 KB 
ID:	41193

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Do you have any other identifying info for record 317? What exactly is it that you are looking at a query or recordset ???

    https://docs.microsoft.com/en-us/off...cmd.gotorecord

    https://docs.microsoft.com/en-us/off...ove-method-dao

  3. #3
    Remster is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2010
    Posts
    317
    Good question. It's a continuous form (the records are out of view to the left).

    I didn't make it clear that I want to get the number while scrolling or hovering. I know how to move to the record once I know the number.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    OK, then I'm not following your question. I'm trying to think of a situation that matches my understanding of your post??
    Typical situation someone knows some aspect to identify a record; design wise you'd use a combo or listbox, scroll through possible selections; select and then the record details would be presented.

    What is the recordsource of your form?
    Sorry.

    Update: just saw Micron's response. I was thinking of absolute position of recordset.
    This (from UA) may be relevant to your question.
    Last edited by orange; 03-06-2020 at 10:38 AM. Reason: spelling

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    I don't know if this works for a continuous form but in a datasheet, if you have a mouseover event on a field it can message box the record id. That being the case, I suspect that you don't want an autonumber id or some such thing, but the record position in the index. I'd try Me.Recordset.AbsolutePosition +1 (+1 because I think it's zero based). Again, maybe this only works on datasheets.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Remster is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2010
    Posts
    317
    OK, this is the situation. I have a main form that contains two unbound subforms side by side. The subform on the left is a read-only continuous form that lists employees (the data is imported from the HR database). It serves as parent to the subform on the right, which contains fields into which data about each employee is entered. The user can scroll through the list of employees on the left and select the person whose data they want to read or modify on the right. This is quite far advanced* and works well, but as a matter of fine tuning, I'm trying to work out a way to highlight the record over which the user's mouse pointer is hovering at any given moment, which is of course unlikely to be the current record, even though it will become the current record if the user decides to click on it.

    The only viable solution I've found so far is to fill the detail section with a button containing the employee's name for its caption, and to use the hover colour property to highlight the relevant record. This works as far as it goes, but there are performance issues. It would be better if I could identify the record through VBA and set the background colour of the detail section conditionally, but all the approaches I've found so far are for identifying the selected record rather than the hovered-over record. The primary key would do, as would the absolute position or the record number, but as far as I can tell, the only one of these that Access picks up in any way at all is the record number via the scrollbar screentip. Hence this thread.

    *Which is why I'm not going to switch to a datasheet, although I very much appreciate the suggestion.

    Edit: On re-reading my original post, I can see how it might have been misunderstood: "Of course there's a way of getting the number: look at the screentip and read it".

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    I didn't suggest that. I said I knew that the method I gave you worked for a datasheet. I left it up to you to determine if it works for a cf.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Any form code you have to identify the record over which you mouse is located may have to accommodate screen resolution variations if it is to be deployed across various hardware/screen resolutions.
    Here is a link to screen position etc materials by Colin/isladogs that may offer some insight.

    Good luck with your project.

  9. #9
    Remster is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2010
    Posts
    317
    Quote Originally Posted by Micron View Post
    I didn't suggest that. I said I knew that the method I gave you worked for a datasheet. I left it up to you to determine if it works for a cf.
    What have I said you suggested that you didn't in fact suggest? I thought you suggested what you've just repeated and I've already expressed appreciation of!

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Maybe you were not referring to me, but you wrote
    Which is why I'm not going to switch to a datasheet, although I very much appreciate the suggestion.
    If there was a suggestion to change to a datasheet, I missed it but it wasn't from me.
    I don't know if this works for a continuous form but in a datasheet, if you have a mouseover event on a field it can message box the record id. That being the case, I suspect that you don't want an autonumber id or some such thing, but the record position in the index. I'd try Me.Recordset.AbsolutePosition +1 (+1 because I think it's zero based). Again, maybe this only works on datasheets.
    All I can definitively say is that the mouseover event on a datasheet field will return either a field value from that record, or the zero based index of that record.

  11. #11
    Remster is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2010
    Posts
    317
    Quote Originally Posted by Micron View Post
    Maybe you were not referring to me ... If there was a suggestion to change to a datasheet, I missed it but it wasn't from me.
    Blimey. I was referring to you, but I wasn't saying that you'd suggested that I change to a datasheet. I was saying that you'd suggested that in a datasheet, if you have a mouseover event on a field it can message box the record ID, which suggestion I very much appreciated at the time.

  12. #12
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Well now that we solved that, does my suggestion work for a continuous form?

  13. #13
    Remster is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Sep 2010
    Posts
    317
    Unfortunately not. You can get the ID of the current record but not the ID of the record you're hovering over. Curiously, the current record triggers Detail_Mousemove, whereas the others trigger Form_Mousemove.

  14. #14
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    You would think there ought to be a way. I found this
    http://www.lebans.com/conformscurcontrol.htm

    but it's so old I can't open it. You might be able to convert it if it looks like it's something you could adapt but that won't help me to look at it if your conversion is 64 bit.

  15. #15
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,979
    As already suggested by Orange, you may be able to use my approach where I can obtain the record from a list box without clicking on it by using a mouse move event.
    There is a more detailed article about this and an example app on my website http://www.mendipdatasystems.co.uk/m...ols/4594549378
    There are 6 forms in the example. The ones that may be relevant to your needs are Forms 4 & 5.

    Hope that helps
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-18-2018, 10:23 AM
  2. Replies: 4
    Last Post: 01-16-2018, 02:51 AM
  3. Replies: 2
    Last Post: 03-05-2015, 01:45 PM
  4. Replies: 4
    Last Post: 02-18-2015, 11:28 AM
  5. Current record number
    By turvoll in forum Programming
    Replies: 1
    Last Post: 11-04-2010, 10:09 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