Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Access 2007. How can I make the a value from a list box link to the form that the list box is on. Sub-form are no problem, you create the form, then when you add the sub form it asks you what field to link with. But I need to use a list box, when the form opens, the records in the list box should be only those related to the form. Sounds simple, but I can't figure this out... Pls aim me in the right direction.

share|improve this question
    
Multiselect or not? –  David W. Fenton Jul 20 '11 at 21:06

1 Answer 1

There is no LinkChild/LinkMaster for listboxes, so no automatic way to filter the contents of the listbox like there is with subforms. The fact that you want to filter the listbox is perhaps a clue that you should consider whether or not you should be using a subform instead.

Anyway, if you insist on doing it, you have to filter the listbox manually, either by setting its Rowsource in an appropriate OnCurrent event (if the listbox is on a main form, in the main form; if it's on a subform, likely in the parent form's OnCurrent). Alternatively, you could hardwire the filter criteria with a form control reference (e.g., Forms!MyForm!MyControl) and in the OnCurrent, you'd requery the listbox.

But I'd step back and first determine that a listbox is the right way to display the data.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.