subform with existing data that limits new input based on mainform

B

Barry

I have an application that contains a mainform with a subform. I've gone
through 2 efforts now and have successfully gotten the subform to populate
with the contents from previous sessions. I've also modified the code to
limit input based on mainform settings. What I can't seem to get working is
both together: i.e. a subform that shows previous input and limits new input
based on the mainform setting.
Here are the details.
mainform contains a control 'supplier'
subform contains the following controls
combobox - parts
text field (hidden) supplier

The mainform references a table orders that contains the columns "orderid",
"supplier".
The subform references a details table that contains the columns 'parts',
'orderid', 'supplier'.
There is also a parts table that contains a Supplier, PartName

The subform properties (on the form) have the link child/master fields set
to the orderid and supplier columns.
The parts combobox has the following for row source:
SELECT DISTINCTROW Parts.* FROM Parts WHERE ((Parts.Supplier)=supplier)
ORDER BY Parts.PartName;

This does successful limit all new input to parts from the associated
supplier, but on subsequent application use, viewing the forms does not
pre-populate the subform with the already existing entries.
I've tried changing and qualifying the column names to make sure there is no
confusion in the sql, but this does not change anything. I have found that
when I remove the supplier column references from the master/child link
properties, the table populates OK, but then does not limit the combobox
selection to a single supplier.
I'm sure this is something simple, either in my design or some property
setting, but I can't figure it out. Can someone help with this?
Thanks.
-b
 

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