How would I go about transferring the values contained in one form to a subform where the values are placed in a new record? The below code is called from a command button and places the values in the subform. However, it places them in the record at which the cursor is in.
I imagine I would need to set focus to the new record, but am unsure of the code. It seems that using the recordset property might be a solution, but I'm not clear on how to make that work. Going to the end of record would just get me to the last record, not where the new record is.
Thanks for your help!!!
----------------------------------------------------------------------
Private Sub cmdCategorySelectAtoL_Click()
On Error Resume Next
DoCmd.GoToRecord acDataForm, "Forms!frmCaseDetails!sfrmCategories", acNewRec
Forms!frmCaseDetails!sfrmCategories.Form.cboCategory.Value = Category
Forms!frmCaseDetails!sfrmCategories.Form.cboSubcategory.Value = Subcategory
Forms!frmCaseDetails!sfrmCategories.Form.cboSubSubcategory.Value = SubSubcategory
DoCmd.Close acForm, "frmCategoriesDetailedList", acSaveNo
Forms!frmCaseDetails!sfrmCategories.Form.Requery
End Sub
I imagine I would need to set focus to the new record, but am unsure of the code. It seems that using the recordset property might be a solution, but I'm not clear on how to make that work. Going to the end of record would just get me to the last record, not where the new record is.
Thanks for your help!!!
----------------------------------------------------------------------
Private Sub cmdCategorySelectAtoL_Click()
On Error Resume Next
DoCmd.GoToRecord acDataForm, "Forms!frmCaseDetails!sfrmCategories", acNewRec
Forms!frmCaseDetails!sfrmCategories.Form.cboCategory.Value = Category
Forms!frmCaseDetails!sfrmCategories.Form.cboSubcategory.Value = Subcategory
Forms!frmCaseDetails!sfrmCategories.Form.cboSubSubcategory.Value = SubSubcategory
DoCmd.Close acForm, "frmCategoriesDetailedList", acSaveNo
Forms!frmCaseDetails!sfrmCategories.Form.Requery
End Sub