List Box

S

Steve Marsden

If have two tables linked with an ID field. I have a form linked to the
first table.
I now want to have a list box which contains values from the second table
only where the ID field in the second table is equal to the ID field of the
current record of the first table. i.e. the record I am currently viewing in
the form.

I have tried all join types but none seem to give me the records in the
second table for just the current record I am on in the main table.

How can I do this or is it not possible with the recordsource property and I
have to fill the list box myself.
 
F

Fredg

Steve,
Set the ListBox RowSource in the Current event of the form.

ListBoxName.RowSource = "Select [SomeField] from Table2 Where [RecordID] = "
& Me!RecordID

The above assumes [RecordID] is a number datatype.
Change the Field and Table names above to whatever the actual names are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top