Solved Use VBA to Hover over field with mouse causing another form to popup (1 Viewer)

Local time
Today, 03:55
Joined
Apr 25, 2019
Messages
62
I have a continuous main form that has a button on it that opens another form with more information about that particular record that the button was on. I want to just hover over the line on the main form and have that same form with the extra info pop up, then close when the mouse moves off that line. Any suggestions?
 
Local time
Today, 03:55
Joined
Apr 25, 2019
Messages
62
not sure what you are saying. i dont see any solution to my question.
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:55
Joined
Sep 21, 2011
Messages
14,301
We are saying that you have asked the question on another site, and have not had the courtesy to mention it on either site? :mad:
Forum etiquette (not just here) is to mention it, so that duplicate advice is not given and people do not waste their time.
You have been here since 2019, AF since 2014, so you you should be aware?, it is not your first post. :(
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 18:55
Joined
Jan 20, 2009
Messages
12,852
Causing a form to pop up when hovering over a control is possible but seems an extreme response with a lot of overhead to run. I couldn't recommend it.

Why not do it on a click of double click on the control?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 09:55
Joined
Feb 19, 2013
Messages
16,612
the problem is that to detect a hover over you need to use the mousemove event, then for a continuous form you need to work out from the mousemove parameters what record row you are over to be able to get the PK of that specific row. Not too difficult if the form has not been scrolled and scrollable window is fully populated (height of scrollable window divided by height of detail section to get the count of visible records multiplied by the position of the mouse in the scrollable window divided by the height of the scrollable window ) and it if it has the you also need to work out by how much it has been scrolled by, or adjust if the number of visible records does not fill the window or the bottom record is only partially visible.

Depending on your form design and how you actually want this to work, you might need to use the mousemove event for every control on the line plus perhaps the detail section as well.

And finally you then need something to close the form when the user's mouse is no longer over the scrollable window

A lot of work when a click, double click or gotfocus event is all you need

But some suggestions as requested:

to get you started - see this link, it will get you partway there for a continuous form

You might also want to look at Colins example here - it is for a listbox but might be possible to modify your form to use a listbox instead or adapt the code to work with a form
 
Local time
Today, 03:55
Joined
Apr 25, 2019
Messages
62
We are saying that you have asked the question on another site, and have not had the courtesy to mention it on either site? :mad:
Forum etiquette (not just here) is to mention it, so that duplicate advice is not given and people do not waste their time.
You have been here since 2019, AF since 2014, so you you should be aware?, it is not your first post. :(
I only use these forums once a year. Forgive me that I did not remember that they are two different websites, each with separate login credentials and no indication whatsoever that they might be the exact same website. You have every right to heavily criticize and threaten me. Please accept my humble apologies. You must be a very happy person. Thank you for the education and enjoy your weekend.
 
Local time
Today, 03:55
Joined
Apr 25, 2019
Messages
62
Causing a form to pop up when hovering over a control is possible but seems an extreme response with a lot of overhead to run. I couldn't recommend it.

Why not do it on a click of double click on the control?
Yes, i can do that easily. I was just hoping a simple popup on hover solution might be already there. thanks!
 
Local time
Today, 03:55
Joined
Apr 25, 2019
Messages
62
the problem is that to detect a hover over you need to use the mousemove event, then for a continuous form you need to work out from the mousemove parameters what record row you are over to be able to get the PK of that specific row. Not too difficult if the form has not been scrolled and scrollable window is fully populated (height of scrollable window divided by height of detail section to get the count of visible records multiplied by the position of the mouse in the scrollable window divided by the height of the scrollable window ) and it if it has the you also need to work out by how much it has been scrolled by, or adjust if the number of visible records does not fill the window or the bottom record is only partially visible.

Depending on your form design and how you actually want this to work, you might need to use the mousemove event for every control on the line plus perhaps the detail section as well.

And finally you then need something to close the form when the user's mouse is no longer over the scrollable window

A lot of work when a click, double click or gotfocus event is all you need

But some suggestions as requested:

to get you started - see this link, it will get you partway there for a continuous form

You might also want to look at Colins example here - it is for a listbox but might be possible to modify your form to use a listbox instead or adapt the code to work with a form
Your reply is what I was expecting. I was hoping there was just a simple event code already written that someone might have had. No worries. I appreciate your explanation for it and will simply use the onclick as everyone is suggesting. Thanks! jm
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 04:55
Joined
May 21, 2018
Messages
8,529
I think you could do this using @isladogs code, as previously mentioned.
However I think the details would have to be in the header or footer of the same form. Similar to the demo. I think if you pop open a form the control with the mouse move would lose focus to the popped open form so having it close from moving off the record may not work.
However, I agree the mouse move would be a strange event to do this. I think the user would be frustrated with forms opening when they do not want it.
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:55
Joined
Sep 21, 2011
Messages
14,301
I only use these forums once a year. Forgive me that I did not remember that they are two different websites, each with separate login credentials and no indication whatsoever that they might be the exact same website. You have every right to heavily criticize and threaten me. Please accept my humble apologies. You must be a very happy person. Thank you for the education and enjoy your weekend.
Firstly they are separate websites, not affiliated at all, however some people are members of both forums, such as moke123, CJ_London and myself amongst a good few others.
I did not see any threat in my post, are you paranoid at all? :unsure:
 

isladogs

MVP / VIP
Local time
Today, 09:55
Joined
Jan 14, 2017
Messages
18,223
My listbox method has been linked twice earlier in this thread.
It can work well for the purpose described but I wouldn't necessarily recommend it for you.

A much simpler and also more common approach is to use a subform for the additional detail ...or a split form
 
Local time
Today, 03:55
Joined
Apr 25, 2019
Messages
62
My listbox method has been linked twice earlier in this thread.
It can work well for the purpose described but I wouldn't necessarily recommend it for you.

A much simpler and also more common approach is to use a subform for the additional detail ...or a split form
Thank you and i agree. i will just use the onclick. thanks!
 

561414

Active member
Local time
Today, 03:55
Joined
May 28, 2021
Messages
280
the line (record) of the continuous main form.
Access will not make it easy with forms, you would have to calculate positions and it'd be just too much trouble.

But here's a dirty approach to this that uses reports. Since you can embed a report inside another report with a "continuous" view, you can get the id of the hovered-over report. Since that is possible, calling the id of that report is easy and thus opening a pop-up form using that id should be easy.

You would have to polish it to have the full functionality, as it's inconsistent at times. Maybe it can be fixed with timers, but I think it's a good start without too much complication. I also hope it can spark an idea to someone.
 

Attachments

  • popup2.accdb
    544 KB · Views: 79
Local time
Today, 03:55
Joined
Apr 25, 2019
Messages
62
Access will not make it easy with forms, you would have to calculate positions and it'd be just too much trouble.

But here's a dirty approach to this that uses reports. Since you can embed a report inside another report with a "continuous" view, you can get the id of the hovered-over report. Since that is possible, calling the id of that report is easy and thus opening a pop-up form using that id should be easy.

You would have to polish it to have the full functionality, as it's inconsistent at times. Maybe it can be fixed with timers, but I think it's a good start without too much complication. I also hope it can spark an idea to someone.
good thinking. i will give that a go. thank you!
 

Users who are viewing this thread

Top Bottom