Its' quite a long question but I've explained it the best way I know how

I have two subforms within a main form.
Each of the subforms are not directly related at the table level.
one subform is for project payments, the other is for the project bank details.
Because each project can have several payments, this means that there can be several records for both subforms.

On the bank Details subform I've made the PK id visible so just for example sake, if there are three records, the ID's might be 01,02,03.

because I need some way of knowing which bank details go with which payment ive updated the BankID PK on the payment table so that I can also show the BankID on the payment subform.
To show the specific bank details that were used for the specific payment the user will use the navigation buttons until for example both the payment and bank subform say 01.

What I want to do is have a combo box on the payment subform that will, for example, list the three records (01,02,03) but when I try this it gives me all of the bank PKs within the table (3000 or so) instead of limiting it to the three records within the specific project


Does any one know how to limit it to just the related records within the combo box?

Any help would be appreciated.

write a query and base the form on that query.
in one of the query's columns use something like this to limit the results: (this is the sql view)
WHERE (((PL.Store)=[forms]![frmtest]![cmbstore]))
(the design view of the column is simply:)
[forms]![frmtest]![cmbstore]

now, as you my know, you are looking at a field on a form (in this case the form, frmtest) ant the field is of course, cmbstore.

so in a previous form (which you will now create) that field exists. the user opens that form first. when the user opens the form you described, the user has already put in the appropriate info for the query to limit the results to your (let's say) 3 rows.

hth...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.