Adding a record to a subform

S

Stephen

I want to automatically add 1 record to a subform when I am about to quit the
Master Form.
My Master form is: Orders
My Subform is: Order Details Subform
I wrote to following...the problem I have is that the New recoed being added
is to the Master Form ...not the Subform. I tried setting the focus to the
subform, then using acNew, but that didn't work.

Any help is appreciated.



Private Sub Exit_Form_Click()
On Error GoTo Err_Exit_Form_Click
'************** ADD FUEL SURCHARGE *************

Forms![Orders]![Order Details Subform].Form![ProductID].SetFocus
DoCmd.GoToRecord , , acNew

'************** ADD FUEL SURCHARGE *************
[Order Details Subform]![ProductID] = 291
[Order Details Subform]![Quantity] = 1
[Order Details Subform]![QtyPcs] = 1

'******* The following gets Pricing, Commission Info specific to each Customer
[Order Details Subform]![UnitPrice] = [Order Details
Subform]![ProductID].Column(3)
[Order Details Subform]![UnitofMeasure] = [Order Details
Subform]![ProductID].Column(4)
[Order Details Subform]![UnitCost] = [Order Details
Subform]![ProductID].Column(6)
[Order Details Subform]![Order Details.CommRateLine] = [Order Details
Subform]![ProductID].Column(9)


DoCmd.Close
 

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