By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Combo Boxes and Subforms

P: n/a
I've posted this a few times without any luck, hoping for some fresh
ideas on this. I'm pretty certain this can be done.

I've been using a micrsoft template to create a supplier database
called the Inventory management database, I have changed this so that
there is a link in the relationships with the suppliers so that every
product entered has a specific supplier related, thats fine the main
problem I've encountered is setting up the combo boxes.

When the SupplierID is selected in the main form I want the productID
inside the subform to limit its list from everyone to just that
supplier.

I have looked on this site:
http://www.techonthenet.com/access/c...ked_combos.php
involving Populating one combo box based on the selection of another
combo box

It works great on one form only can it work with a subform set up like
the one I have?

Jan 17 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I haven't done a whole lot with subforms. I usually use directed forms
like I would when I use ASP.

When I do use subforms it really quite simple. You choose the two
fields that you want to link together between the subform and the main
form. Then you have your combobox set up to move to whatever record
you selected within the AfterUpdate method.

Usually I let the wizards (combobox and subform) do all the work and
then I modify my subform however I would like.

Now, if you're using Unbound forms then you've created more work for
yourself and you will have to modify the filter or recordset of the
subform yourself. I believe these can be accessed through:

me.subformname.form.recordset
and
me.subformname.form.filter

but you might want to check the help on subforms for that.

Cheers,
Jason Lepack

Phil wrote:
I've posted this a few times without any luck, hoping for some fresh
ideas on this. I'm pretty certain this can be done.

I've been using a micrsoft template to create a supplier database
called the Inventory management database, I have changed this so that
there is a link in the relationships with the suppliers so that every
product entered has a specific supplier related, thats fine the main
problem I've encountered is setting up the combo boxes.

When the SupplierID is selected in the main form I want the productID
inside the subform to limit its list from everyone to just that
supplier.

I have looked on this site:
http://www.techonthenet.com/access/c...ked_combos.php
involving Populating one combo box based on the selection of another
combo box

It works great on one form only can it work with a subform set up like
the one I have?
Jan 17 '07 #2

P: n/a
Sort of... You're going to have to reference the form and subform by
name though. Once you change the value of the main form's combo
(AfterUpdate event), you need to set the subform's combo box RowSource
(which will be based on the value of the main form's combo).

For example, if you choose "XYZ" from the Supplier combo, in the
AfterUpdate event you have to say something like (and this isn't the
proper syntax) "form!frmSubform.cboProduct.RowSource = 'Select * from
SomeTable where Supplier = ' & me.cboSupplier & '"

That is EXTREMELY convoluted, but the logic is correct. Do some
searches on referencing a subform's object from a main form and you
should be able to find the proper syntax to use.

Phil wrote:
I've posted this a few times without any luck, hoping for some fresh
ideas on this. I'm pretty certain this can be done.

I've been using a micrsoft template to create a supplier database
called the Inventory management database, I have changed this so that
there is a link in the relationships with the suppliers so that every
product entered has a specific supplier related, thats fine the main
problem I've encountered is setting up the combo boxes.

When the SupplierID is selected in the main form I want the productID
inside the subform to limit its list from everyone to just that
supplier.

I have looked on this site:
http://www.techonthenet.com/access/c...ked_combos.php
involving Populating one combo box based on the selection of another
combo box

It works great on one form only can it work with a subform set up like
the one I have?
Jan 17 '07 #3

P: n/a
Hey

I'm not very good with giving you an answer with such a vague
description. There are too many different ways you could have set
everything up, each one would change the answer slightly.

So if you would like, you are more than welcome to email your database
and I will have a look and let you know exactly how to make it work.

Cheers

Jan 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.