Add item to subform with dbl-clk event

S

Sammie

On a form where users enter data used to create an invoice (patterned after
the sample Northwind db), I use a combo box to enter products into a
subform, which is in datasheet view. I want to allow my users more
extensive searching capability for the correct product than a simple
drop-down list. I have created a pop-up form for this.



When the user dbl-clicks on a blank row in the combo box, the pop-up form
opens. How can I have the user dbl-click the desired value in the pop-up
form and enter that value in the subform, and then close the pop-up form?
Currently the user has to copy/paste, which is akward.



Main form: frmInvoices

Subform: Invoice Subform

Pop-up form: frmProductsPopup



Is there a way for the pop-up form to work in datasheet view without being a
a subform of the subform?



Thanks.

Sammie SBS 2003, OFFICE 2003, XP-PRO-SP3, IE7
 
D

Douglas J. Steele

To refer to a control on a subform, you use:

Forms![NameOfParentForm]![NameOfSubformControl].Form![NameOfControlOnSubform]

Note that depending on how the form was added as a subform, the name of the
subform control may be different than the name of the form being used as a
subform.

You'd put code in the DblClick event of the control on the pop-up form to
set the control on the subform to the selected value.
 
T

Tom van Stiphout

On Mon, 12 Jan 2009 07:38:08 -0600, "Sammie" <[email protected]>
wrote:

In the popup cmdOK_Click event, write something like:
Forms!frmInvoices!mySubformControl.Form!myProductControl.Value =
Me.myProductControl
(replace the "myXxx" names with yours. Note there is/can be a
difference between the name of the subform control and the name of the
subform)

-Tom.
Microsoft Access MVP
 

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