By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,476 Members | 1,553 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,476 IT Pros & Developers. It's quick & easy.

Copy data from one form to another and create a new record to add data

P: n/a
Ok, here's the outline:

I have a form called frmOrders, which has a subform (frmOrderDetails)
and another form called frmProducts.

In frmOrderDetails, when I double-click on a field called ProdDescrip
it opens frmProducts, which gives me a product list and it's prices.
When I double-click a product, automatically add the products to the
frmOrderDetails fields ProdDescrip and UnitPrice. But I can't save the
record in frmOrderDetails and move to a new one so I can add more
products.

This is the code on frmProducts

Private Sub ProductName_DblClick(Cancel As Integer)

Forms![frmOrders]![frmOrderDetails]![ProdDescrip] = [ProductName]
Forms![frmOrders]![frmOrderDetails]![UnitPrice] = [ProductPrice]

I've already tried with SaveRecord, GetFocus, and nothing seems to
work.

Any suggestions?

Nov 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Do you get an error message when you try to save your order details
record? If so, what is it?

Bruce

Nov 13 '05 #2

P: n/a
There's no error... it only stays in the same record on the subform.

I've tried with this:

Private Sub ProductName_DblClick(Cancel As Integer)

Forms![frmOrders]![frmOrderDetails]![ProdDescrip] = [ProductName]
Forms![frmOrders]![frmOrderDetails]![UnitPrice] = [ProductPrice]
DoCmd.RunCommand acSaveRecord
DoCmd.RunCommand acRecordGoToNew

But it saved the record and create a new one on the frmProducts, not
the frmOrderDetails subform.

Nov 13 '05 #3

P: n/a
Try replacing your DoCmd...SaveRecord with either

Forms!frmOrders!frmOrderDetails.Form.Dirty = False

or

Forms!frmOrders!frmOrderDetails.Form.Refresh

provided that the Order Details subform object on frmOrders has the
same name as its source form (frmOrderDetails).

Bruce

Nov 13 '05 #4

P: n/a
I got to save the record. But how do I get to create automatically a
new record on the subform (frmOrderDetails)? 'Cause the goal is to add
automatically products to the subform by double-clicking on the
ProductName field of frmProducts.

Richie

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.