Newbie combobox question

G

Guest

My form has two unbound comboboxes, cbxCategory and cbxProduct. cbxCategory
gets its values from a table, and a "SELECT....WHERE...." in its AfterUpdate
event supplies the RowSource for cbxProduct. All of this works fine, but
when my continuous form first opens, both cbx's are empty and ALL the records
show. How do I do the following:

a) When the form opens, I want cbxCategory to be showing its first value
already (Dry goods), and only the matching dry-goods records should be
showing in the form. How can this be done?

b) As a second question, it would be even better if, when the form opens,
cbxCategory is on its first record (Dry-goods) and cbxProduct is on its first
matching record. What is a good way to do this as well?

thank you
 
G

Guest

Hi Victoria,

Use something similar to this in the Form Open event:

Me.cbxCategory = Me.cbxCategory.ItemData(0)
me.cbxProduct.requery
me.cbxProduct = Me.cbxProduct.ItemData(0)
me.SUBFORMNAME.form.requery

Damian.
 
G

Guest

Works well - thanks!

Damian S said:
Hi Victoria,

Use something similar to this in the Form Open event:

Me.cbxCategory = Me.cbxCategory.ItemData(0)
me.cbxProduct.requery
me.cbxProduct = Me.cbxProduct.ItemData(0)
me.SUBFORMNAME.form.requery

Damian.
 

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