Set a combo to an entry and clear all

G

Guest

Using Office 2003 and Windows XP;

I have a couple combo boxes on a form that are being used like filter
choices for two subforms.

1) How can I programmatically set a combo box to the first entry (combo is
on main form)?

2) How can I programmatically clear all the entries in a combo box before
requerying (while a form is open - combo resides on main form)? --- I'm
presuming this code would/could be put in the After_Update event...?

Please show generic code examples if possible.

Thanks much in advance.
 
P

Perry

Use the combo's on mainform to buildup the filter criteria for yr subform(s)

Code could read something like:
(assuming sfrmCompany is a subform and cboCompanyID is a combobox
on mainform listing company info)

If not Isnull(me.cbocompanyID) Then
me.sfrmcompany.form.filter = "companyID=" & me.cbocompanyid
me.sfrmcompany.form.filteron = true
else
me.sfrmcompany.form.filter = ""
me.sfrmcompany.form.filteron = false
end if

Krgrds,
Perry
 

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