PDA

View Full Version : VBA MSAccess - List box



lienlee
05-26-2010, 01:14 PM
Hi, I'm new here and to VBA and MS Access. I'm currently doing a project with list box and im trying to grab data when one of the field is clicked. For example. Application is clicked and it grabs a certain page/data.

How do i go about selecting what field i want and the information that goes along with it?
can everything be done in event procedure?. - on click.
what are the steps? into getting it work. ex. creating a variable for the listbox.etc.

I attached what my listbox looks like. Incase my explanation isnt clear.

edit: i have buttons that link to the data/info, but i want to change the buttons so it works with the attached listbox instead of the buttons. i have no clue where to start..

austenr
05-26-2010, 04:13 PM
Might need more to go on. Yes you can do it but what is the destination of the data, a form?

austenr
05-26-2010, 04:17 PM
If its a form,then why not simply let Access do all the work? You may have done some of this already.

Create a form using your table/query as the Record Source.
Go to the Field List and drag the fields you want retrieved onto the form
Place a listbox on the form. When the ListBox Wizard comes up:

Select "Find a record on my form based on the value I've selected..."
Next
Select the appropriate identifying field to appear in the Listbox
Next
Size the Listbox column
Next
Name the listbox
Finish