Enter ProductID from search form to order form

atisz

Registered User.
Local time
Today, 09:04
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 (Cod_Prod) field from frmOrderDetails.
Initially, I had this search code on the double-click event, which I think (and HOPE!) can be easily modified for my needs:

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 ProductID (Cod_Prod) field from sfrmOrderDetails, just unfortunately I'm not that good in coding, that's the reason why I'm needing help.
 

Attachments

You have to create a subform with a continuous form. An Order could have more than one OrderItem. Look at the microsoft sample databases Northwind.mdb, Solutions.mdb but especially Orders.mdb.
You can find them on the internet.

Enjoy!
 
Northwind.mdb
Solutions.mdb
Order.mdb
 

Attachments

Thanks

Thanks, Guus2005. I'm going to take a look to the attached databases, and I hope I will found the answers for my questions.

Attila
 

Users who are viewing this thread

Back
Top Bottom