Set combobox value on Seperate form close

P

pfm721

I have a from "Form1" that has a subform "frmInfosub". Sub form has a combo
box to select a vendor. If the vendor is not in the list the can click on
<New> and it will open the add vendor form. When that form closes I would
like the Vendor name combo on my subform to display the vendor that was just
entered. I am having a problem getting the coding right for this.

I know that if the field was just on the mainform it would look like this

Forms!Form1.cboVendor.Refresh

However I am not sure how to code for an item on a subform

thanks.
 
R

rm

This is a "rough" estimate based on memory and the fact that I had
trouble with this too... Look in the help file - there is a topic in
there about this exact issue. I think that you have to set focus on
the sub form then requery.

On the other hand you can create a public function in the sub form
with a line to requery the combo box on the sub form. I am no so sure
that that would be the cleanest approach though.
 
D

Douglas J. Steele

Assuming that the name of the subform control on Form1 is named frmInfosub,
you'd use

Forms!Form1!frmInfosub.Form!cboVendor

Depending on how you added frmInfosub as a subform, though, the name of the
control on Form1 may be different. If it is, use the name of the control
rather than frmInfosub.
 

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