I have a main form and a continuous subform which is connected to main form using invoice id, customer name and invoice date
. When I add a new invoice, I select customer in main form and enter data in subform because I allow edits in my subform.
Now if I change customer in main form, customer should also change in subform for the data which I already added. But my subform turns to blank, when I select previous customer it shows the entered data.
I want my subform customer update to newly selected customer in main form. I used some vba code but its not working. The below code I got from a tutorial.
Private Sub Customer_Name_AfterUpdate()
With Me.[Sales_Invoice_Detail(its my subform].Form.RecordsetClone
Do Until .EOF
.Edit
!Customer_Name = Me.Customer_Name (This is the Field which i want to update in my subform)
!Invoice_Id = Me.Invoice_Id( it has one to many relationship between forms)
.Update
.MoveNext
Loop
'MsgBox "You Change Customer To " & Customer_Name & "!"
End With
Me.Refresh
End Sub
.requery
of the subform if it's query based. How is the form set up, have you used the form wizards linking? – Nathan_Sav