VBA trouble opening form for newly added record

OK, I am taking some tutorials, so I will post when I work at that part of it b/c I think that is the problem, too. Everything else like how I set up the command button to open the pop up form, etc. is by the book/these tutorials I'm taking, so something is wrong elsewhere. I will post when I have figured this out. Thank you!
 
ANSWER: I had to create a subform based on the Node Table of just the Node Names, Node A and Node B, and add that subform to the Node Setting pop up form.

https://drive.google.com/open?id=0B9IyKJSJ52ghRjh4X19YSDZ3UUE

Now when I click to open the pop up form from the parent node subform, I will always get those nodes from the parent subform to appear in the pop up form.

You can see in the picture that NodeID 6 in the parent subform (the gray box) matches the pop up Node Setting form as NodeID 6 (the gray box to the far right), and it matches the NodeID in the new subform of node names, NodeA, and NodeB in the Node Setting pop up (the gray box next to the node names).

BUT, if you add new nodes to the parent subform, you have to add code to the Open Form button (I don't know if RefreshRecord or Requery is right, but this seems to work):
Code:
Private Sub cmdOpenSetting_Click()
    DoCmd.RefreshRecord
    If IsNull(NodeID) Then Exit Sub
    DoCmd.OpenForm "popfrmNEWNodeSetting22", , , "NodeID=" & NodeID
End Sub

AND add the following to the default value property of the NodeID field on the Node Setting Pop Up Form:
Forms!MainFormName!SubformName.Form!NodeID

This will autopopulate the NodeID field in the pop up form with the Node ID from the parent subform for new adds. And since the NodeID of the node subform I just added to the pop up form are linked by the master/child link or form/subform relationship, then the subform of the nodes will autopopulate with the NodeID and NodeA and NodeB node names.

Thank you for your help, MarkK. I appreciate it.
 

Users who are viewing this thread

Back
Top Bottom