469,285 Members | 2,524 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,285 developers. It's quick & easy.

How to show listbox content using "on mouse over event" vba

Hi All,

Thank you in advance for your valuable help. I'm working on a project in which I have a form with 3 listbox each one of them has long string content. So I would like to be able to allow the user to see the content using "On mouse over event" with vba. Any help will be greatly appreciated.

Thanks!

Joe
Mar 3 '11 #1

✓ answered by ADezii

You can sort of mimic this behavior by:
  1. Single Clicking an Items in the List Box, thereby Selecting that Item.
  2. Keeping the Mouse Pointer positioned over the Selected Item.
  3. Setting the ControlTipText Property to the Item Selected.
  4. This can actually be done in the AfterUpdate() Event of the List Box.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub lstDemo_AfterUpdate()
    2.   Me![lstDemo].ControlTipText = Me![lstDemo].Column(1)
    3. End Sub

9 14339
patjones
931 Expert 512MB
Hi Joe,

What do you mean by "see the content"?

In any case, Access does not have a mouse-over event. This was something I looked into when I first started designing forms in Access. It's not to say that it isn't possible to custom code something in VBA to accomplish this, but I suspect that it would require some system API programming and such.

The closest built-in functionality is the "screen tip" that you can set to pop up when mousing over a control.

Pat
Mar 3 '11 #2
Hi Pat,

Thanks so much for the quick response. Sorry if I didn't make myself clear. I kind of new with vba.

I have a listbox with long string content items. I would like the user to see the complete item string line when they pointed with the mouse. Is there any way to do this? Thanks again!

Joe
Mar 3 '11 #3
ADezii
8,800 Expert 8TB
You can sort of mimic this behavior by:
  1. Single Clicking an Items in the List Box, thereby Selecting that Item.
  2. Keeping the Mouse Pointer positioned over the Selected Item.
  3. Setting the ControlTipText Property to the Item Selected.
  4. This can actually be done in the AfterUpdate() Event of the List Box.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub lstDemo_AfterUpdate()
    2.   Me![lstDemo].ControlTipText = Me![lstDemo].Column(1)
    3. End Sub
Mar 4 '11 #4
Hi ADezii,

You are great! That works very well for what I needed. Thanks so much for your help.

Joe
Mar 4 '11 #5
ADezii
8,800 Expert 8TB
You are quite welcome, Joe. Glad it worked out for you.
Mar 4 '11 #6
ary1
2
But how to wrap text of toolrip if the string is too long , id any method for it
Nov 30 '12 #7
NeoPa
32,173 Expert Mod 16PB
Normally we don't allow follow-on questions from other members, but as this one is so closely attuned to the original I'll let it slide, and even answer.

The answer's simple enough. This approach uses the built-in TooltipText property of the control. As such, there is no control over how the data is displayed unless you would like to doctor the data before inserting it into the property. Less straightforward, and highly dependent on your data. Even worse, I can't even say for sure that it would work :-D

PS. I tested it and it works fine, but you'd still need to determine where to insert your vbNewLine characters ;-)
Nov 30 '12 #8
ary1
2
Thanx
But can you give an example, I am trying to display controltiptext by giving refrance like after selecting tabindex of selected row of listbox and displaying where rowsouce -sheet!a1:b4 but if I put long string is displaying more than screen
Nov 30 '12 #9
NeoPa
32,173 Expert Mod 16PB
Not here I'm afraid. Your last post missed being a hijack by the width of a gnat's hair. Please post your question in it's own thread if you'd like further help with this.
Nov 30 '12 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

20 posts views Thread by DraguVaso | last post: by
1 post views Thread by S. van Beek | last post: by
2 posts views Thread by Ron M. Newman | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.