General discussion

Locked

ListBox

By scjohn ·
Can soome one help me. i have a listbox displaying times. From 8 am to 11 pm, I am trying to be able to select a time from the listbox and have it go to a textbox on a different form when i close the form with the listbox, im sure this is easy butim still new to access. thanks

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Don't develop in access but usually

by Tony Hopkinson In reply to ListBox

There should be an OnUnload, OnExit, Onclose type handler on your form with the first list box. It executes when you close the form.

In there you put something like
MyOtherForm.MyTextBox.text = MyListBox.ListItems(MyListBox.selected)

where selected is the index of the item in the list, and listItems is the list of items in the box.

You should check selected (if nothing is selected will be -1 or sometimes zero, depending on the language). You might also get unexpected results if multi-select ot range-select are enabled on the listbox.

Access being such a poor development environment will probably forgive you for not making sure MyOtherForm exists, but in a professional development environment doing the above would be a very bad practice, and should get you a severe talking to by a senior developer.

Suggest you hit the help and look for events, you'll find all sorts of interesting stuff out.

Have fun.

Collapse -

modules.

by ma407 In reply to ListBox

Maybe use a module.

THere you create a GLOBAL variable to refer to the selected text in the list box.

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums