By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,327 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,327 IT Pros & Developers. It's quick & easy.

Action listener for MS Access VBA

P: 1
At this moment im working on a _MouseMove function, and I have a question about my function. When somebody moves his mouse over the checkbox, a different label shows a description from a database. The function GetDescription uses the checkbox name c73 in a query to select the right description. In the function GetDescription a query uses c73 as a where statement. That isnt the problem, thats the way it works.

But c73 is the last checkbox i have, and it starts with c01, so i have 73 checkboxes that all needs to do the same thing.

The question is: Is there some kind of action listener the keeps me from creating 73 MouseMove statements, and makes it possible to create one MouseMove for all the checkboxes?

Checkbox Code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub c73_MouseMove(Checkbox As Integer, Shift As Integer, X As Single, Y As Single)
  2.     Dim varDescription As String
  4.     varDescription = GetDescription(Me.c73.Name)
  5.     Me.labelInfo.Caption = varDescription
  7. End Sub
Dec 7 '06 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,661
There is a Form MouseMove event.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2. End Sub
This would involve recognising in your code which X & Y positions were associated with which control on your form, however. Maybe an array built in the Form_OnOpen() event could help, or even using an algorithm to work out where each is. Also, the actual parameters for each control are available to you via :
Expand|Select|Wrap|Line Numbers
  1. For Each ctlThis in Me.Controls
  2.     With ctlThis
  3.         Debug.Print .Top, .Left, .Height, .Width
  4.     End With
  5. Next ctlThis
Dec 7 '06 #2

Post your reply

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