Need to navigate records on the form behind my current form
I'm working with 2 forms - "Purchase Orders" and "Product List." The "Product List" form is a pop-up form that is initiated from the "Purchase Order" form. I want the ProductID that I select from the product list form to be inserted into the next available field in the purchase order form (actually it's a subform within the purchase order form). I have everything working except checking to see if the current record is blank, and if it is not blank to insert the information in a new record. Here's the code:
The line that is commented out is the statement I'm having problems with. I originally wrote it as: DoCmd.GoToRecord, , acLast - however, when I did that it took me to the last Purchase order record instead of the last record on the purchase order subform.
Thanks in advance for the help
I'm working with 2 forms - "Purchase Orders" and "Product List." The "Product List" form is a pop-up form that is initiated from the "Purchase Order" form. I want the ProductID that I select from the product list form to be inserted into the next available field in the purchase order form (actually it's a subform within the purchase order form). I have everything working except checking to see if the current record is blank, and if it is not blank to insert the information in a new record. Here's the code:
Code:
Private Sub ProductList_DblClick(Cancel As Integer)
Dim intProductID As Integer
intProductID = Me.ProductList
Forms![Purchase Orders].SetFocus
Forms![Purchase Orders]![Purchase Orders Subform].SetFocus
[COLOR=Red]'DoCmd.GoToRecord acDataForm, Forms![Purchase Orders]![Purchase Orders Subform]![ProductID], acLast[/COLOR]
'The go-to-last record command is not working
If Forms![Purchase Orders]![Purchase Orders Subform]![ProductID] = Not Null Then
DoCmd.GoToRecord , , acNext
End If
Forms![Purchase Orders]![Purchase Orders Subform]![ProductID] = intProductID
Forms!frmProductPickFromList.SetFocus
DoCmd.Close
End Sub
The line that is commented out is the statement I'm having problems with. I originally wrote it as: DoCmd.GoToRecord, , acLast - however, when I did that it took me to the last Purchase order record instead of the last record on the purchase order subform.
Thanks in advance for the help