Visit our new web pagesWe have launched a new extended set of web pages at www.alvechurchdata.co.uk. These old pages will stay on the server because people still have links to them but they will not be updated. The new version of this page is at www.alvechurchdata.co.uk/hints-and-tips/acclistbox.html. |
||
Home About us Development Training Support |
Linking two Access listboxesA single listbox is a good way of letting users select an entry from a table. Sometimes though, users' requirements are more complex and they need to be able to make the selection in two stages. The sample form below shows one list box showing a choice of courses and a second box showing the dates when the selected course is running:
Two simple changes synchronize the two listboxes. The first is to set the RowSource of the right-hand listbox:
Select CourseID, Startdate
   From tblCourse    Where CourseTypeID=lstCourse    Order By Startdate; The second is to make sure that the right-hand list box is updated every time that a new selection is made on the left. Put this code into the Click event of the listbox:
Private Sub lstCourse_Click()
   lstDates.Requery    End Sub This works because the Click code runs whenever the user changes to a new row in the list box - regardless of whether the change is made by a mouse click or the cursor keys. |
Hints & tips
The textbox class in Visual FoxPro 9 has a new Autocomplete
property which shows the user the previous values that have
been entered in that textbox.
More...
|