What is the proper syntax of the DoCmd.OpenForm Statement? I have a subform (subform_List) and when any field in the row of the subform is clicked, it should open a form (form_Update) and display the record that contains the values of the 4 fields listed below in the subform - DName, SNum, VNum, PNum. These values make the record unique. The rows in the subform are from the same table that form_Update was created from. The subform is actually a subset of all the fields provided in the "form_Update" which is to be used to edit additional information.
Below is what I tried the fields on the left are the fields on form_Update and the Forms!form_Main!subform_List are the subform field. I'm getting a runtime error of 2465 and it doesn't know what I am referencing.
Private Sub DName_Click()
DoCmd.OpenForm "form_Update", , , _
"DName = " & Forms!form_Main!subform_List.Form.DName _
And "SNUM = " & Forms!form_Main!subform_List.Form.SNum _
And "VNum = " & Forms!form_Main!subform_List.VNum _
And "PName = " & Forms!form_Main!subform_List.Form.PName
End Sub
Appreciate your help.
Below is what I tried the fields on the left are the fields on form_Update and the Forms!form_Main!subform_List are the subform field. I'm getting a runtime error of 2465 and it doesn't know what I am referencing.
Private Sub DName_Click()
DoCmd.OpenForm "form_Update", , , _
"DName = " & Forms!form_Main!subform_List.Form.DName _
And "SNUM = " & Forms!form_Main!subform_List.Form.SNum _
And "VNum = " & Forms!form_Main!subform_List.VNum _
And "PName = " & Forms!form_Main!subform_List.Form.PName
End Sub
Appreciate your help.