Enter ProductID from search form to order form

atisz

Registered User.
Local time
Tomorrow, 01:05
Joined
Apr 5, 2005
Messages
96
Hi,

I have a form frmOrders which contains frmOrderDetails as subform. When I want to add a new product to order from frmOrderDetails by clicking Add product button, frmAdvancedSearch is opened. This contains an unbound text box called txtSearch and a list box called SearchList, which displays the search result (ProductID, ProductName) based on what it is typed in txtSearch text box.
Now I would like to make possible this: when I double-click a product from the list box, that product is added automatically to the order, by entering its ID to ProductID field from frmOrderDetails.
How could be done this?


Attila
 
Is the OrdersDetails subform a Datasheet For or Continous Form?

Can you post a sample DB?
 
Sample DB

Is the OrdersDetails subform a Datasheet For or Continous Form?

Can you post a sample DB?



Here is the sample DB.
 

Attachments

Last edited:
Is this a project for school?

Place code into the OnDblClick event of the Search Form ListBox. This code will need to Read the Column of the ListBox for the item that was selected since your ListBox does in fact contain Columns.

Think about or research what it takes to access a SubForm with code, you will see how to do it all over this Forum in many many posts.

Here is a Tip:

The Column you want to place into the Cod_Prod TextBox located in the sfrmOrderDetails SubForm is Column(0, ......).

.
 
Not a school project

Is this a project for school?

Place code into the OnDblClick event of the Search Form ListBox. This code will need to Read the Column of the ListBox for the item that was selected since your ListBox does in fact contain Columns.

Think about or research what it takes to access a SubForm with code, you will see how to do it all over this Forum in many many posts.

Here is a Tip:

The Column you want to place into the Cod_Prod TextBox located in the sfrmOrderDetails SubForm is Column(0, ......).

.

Thanks for your reply CyberLinx.
No, it's not a project for school! I'm making simple or more complex databases since few years, since 2002, I think. Actually, this one will grow into a complex database, since now I have used it as an invoice application, and for keeping my eyes on my own business: suppliers, customers, spent money for raw materials, incomings, payed/unpaid invoices, and so on. Now I would like to add some new features to this database, and make some changes to help myself work faster, avoid complications and mistakes.
The attached sample it's just a small part of the whole database, the part which is involved in my question.
In fact, I use a search form, like that from the sample_DB, to search for invoices, it displays more information on 7 columns, and have the following code on the on double click event:

Private Sub SearchList_DblClick(Cancel As Integer)
On Error GoTo Err_SearchList_DblClick
Dim db As DAO.Database
Dim rst As DAO.Recordset

DoCmd.OpenForm "frmOrders"
DoCmd.Maximize

Set rst = Forms!frmOrders.Recordset.Clone

rst.FindFirst "[Cod_Com] = " & Me.SearchList
Forms!frmOrders.Bookmark = rst.Bookmark

DoCmd.Close acForm, Me.Name

Exit_SearchList_DblClick:
Exit Sub

Err_SearchList_DblClick:
MsgBox Err.Description
Resume Exit_SearchList_DblClick

End Sub


I think this can be modified to be used for entering the product ID into Cod_Prod field from sfrmOrderDetails, just unfortunately I'm not that good in coding, that's the reason why I'm needing help.

Attila
 

Users who are viewing this thread

Back
Top Bottom