I have 3 Tables - that each have their own data entry form. All 3 tables are related through a one to one relationship.
I have added the following code to the AfterInsert event of the parent form:
Private Sub Form_AfterInsert()
If Me.NewRecord = True Then
CurrentDb.Execute "Insert Into Table2 (ClientID) Values(" & Me.ClientID & ")", dbFailOnError
CurrentDb.Execute "Insert Into Table3 (ClientID) Values(" & Me.ClientID & ")", dbFailOnError
End If
End Sub
After completing the parent form I encounter a compile error when I put my cursor in the subform – method or member not found. If I stop the debugger and return to the subform I am able to continue to the subform displaying the correct ClientID. It seems like a a timing thing, as though my parent form is not saving to Table1 quickly enough. Do I need to add another step or is it perhaps on the wrong event?
Thank you!!
I have added the following code to the AfterInsert event of the parent form:
Private Sub Form_AfterInsert()
If Me.NewRecord = True Then
CurrentDb.Execute "Insert Into Table2 (ClientID) Values(" & Me.ClientID & ")", dbFailOnError
CurrentDb.Execute "Insert Into Table3 (ClientID) Values(" & Me.ClientID & ")", dbFailOnError
End If
End Sub
After completing the parent form I encounter a compile error when I put my cursor in the subform – method or member not found. If I stop the debugger and return to the subform I am able to continue to the subform displaying the correct ClientID. It seems like a a timing thing, as though my parent form is not saving to Table1 quickly enough. Do I need to add another step or is it perhaps on the wrong event?
Thank you!!