Get Record from PopupForms

  • Thread starter Thread starter Abdul Shakeel
  • Start date Start date
A

Abdul Shakeel

Hi All,

I ask this question third time on this forum.......please help me on the way
I have customer Order Form, Includes General Customer Information & Order
Details on the Sub Form Sub form contains Prduct Name, Unit, Rate I want that
when I am on Product Field by pressing a shortkey Like Ctrl+D a popup form
appear and ask for character or Keywords to be enter for searching a
particuler product e.g. I have apple as product the Keyword "app" appears it
in product field or a popup form appear contains list of all product when I
double click on a particuler product it appears on Product field.

Thanks.
 
Abdul Shakeel said:
Hi All,

I ask this question third time on this forum.......please help me on the
way
I have customer Order Form, Includes General Customer Information & Order
Details on the Sub Form Sub form contains Prduct Name, Unit, Rate I want
that
when I am on Product Field by pressing a shortkey Like Ctrl+D a popup form
appear and ask for character or Keywords to be enter for searching a
particuler product e.g. I have apple as product the Keyword "app" appears
it
in product field or a popup form appear contains list of all product when
I
double click on a particuler product it appears on Product field.


Let me restate this to see if I understand what you're after, because I'm
not sure I do. The purpose of the popup form is to assist in choosing a
product to add to the order. On the popup form, the user enters a partial
product name, and all matching products then appear in a list. When you
double-click a product in that list, the product is added to the Order
Details subform on the Order form. Is that right?

If what I've said is correct, it's pretty straightforward to do in
principle, but without knowing the details of your forms and tables, I can
only give you an outline of the procedures to follow.

1. Open popup form on shortcut key.

To do this, you can set an Autokeys macro for the key-combinaton you want --
see help for "autokeys". Or you can use the Order form's KeyDown event
(after setting its KeyPreview property to Yes) to catch every key pressed,
identify trap the combination you want, and open the popup form.

2. Designing the popup form for searching products.

Controls on the popup form would include a text box (for entering the string
to search for) and a list box. Suppose that the popup form is named
"frmChooseProduct", the text box is named "txtSearch", and the list box is
named "lstProducts". Set the list box's RowSource property to a query along
this lines:

SELECT ProductID, ProductName FROM Products
WHERE
ProductName Like '*' & [Forms]![frmChooseProduct]![txtSearch] & '*'
AND
[Forms]![frmChooseProduct]![txtSearch] Is Not Null;

Use the AfterUpdate event of txtSearch to requery the list box:

'----- start of example code -----
Private Sub txtSearch_AfterUpdate()

Me!lstProducts.Requery

End Sub
'----- end of example code -----

3. Adding double-clicked products to the subform.

Use the DblClick event of the list box to accomplish this. There are (at
least) two ways to go about it: (a) add the product directly to the table on
which the OrderDetails subform is based, and then requery it, or (b) add the
product to the form itself directly. To simplify things, I'll show the
latter.

'----- start of example code -----
Private Sub lstProducts_DblClick(Cancel As Integer)

If CurrentProject.AllForms("frmOrder").IsLoaded = False Then
Exit Sub
End Sub

With Forms!frmOrder!sfOrderDetails.Form

If Not .NewRecord Then
.Recordset.AddNew
End If

!ProductID = Me!lstProducts

End With

End Sub
'----- end of example code -----

That's all air code, but it should give you the general idea.
 
"Abdul Shakeel" <[email protected]> ¦b¶l¥ó±i¶K¤º®e¥D¦® (e-mail address removed) ¤¤¼¶¼g...
Hi All,

I ask this question third time on this forum.......please help me on the way
I have customer Order Form, Includes General Customer Information & Order
Details on the Sub Form Sub form contains Prduct Name, Unit, Rate I want that
when I am on Product Field by pressing a shortkey Like Ctrl+D a popup form
appear and ask for character or Keywords to be enter for searching a
particuler product e.g. I have apple as product the Keyword "app" appears it
in product field or a popup form appear contains list of all product when I
double click on a particuler product it appears on Product field.

Thanks.



---
avast! ¨¾¬r³nÅé: ¶Ç¤Jªº «H®§²M²z.
¯f¬r¸ê®Æ®w (VPS): 000773-1, 2007/09/06
ÀË´ú®É¶¡: 2007/11/23 ¤U¤È 02:20:53
avast! - ª©Åv (c) 1988-2007 ALWIL Software.
http://www.avast.com
 

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

Similar Threads


Back
Top