Access VBArun code on selection of list box item

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

I have a an Access form with a list box. When the user makes a selection I want to run some code using the selected value and then close the form automatically
What is the best event to use for this in the list box and what VBA code would I use?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software & Systems Engineer
Commented:
The click Event should be just fine
Private Sub YourList_Click()
MsgBox Me.YourList 'Me.YourList will give you the value..
'if you have multicolumn you can use Me.YourList.Column(IndexNo)
'   Some code here
Docmd.close
End Sub

Open in new window

Murray BrownASP.net/VBA/VSTO Developer

Author

Commented:
thanks very much

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial