I have a subform displaying a list of products (module name and number) the list on the subform is determined by a field in the main form. I have placed a button that appears next to each list item and i want it to close the form and pass the module name and number to another form on opening. I am trying to make the following code work, but i get error message saying cant find Products form. I think this is due to it being a subform.
___________________________________________________________
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "NewModule"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms![Products]![ModuleNumber] = Forms![NewModule]![ModuleNumber]
Forms![Products]![ModuleName] = Forms![NewModule]![ModuleName]
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub