Updating a control from a subform

aproctorpe001

Registered User.
Local time
Today, 08:51
Joined
Nov 19, 2001
Messages
17
I have a textbox control on the form New Friend Input Form Version 7 called LastContactDate. I have a subform of this called Meetings which captures the details of contacts with the friend. What I'm trying to do is when I enter a new meeting date-that this automatically updates the LastContactDate in the main form however the following code doesn't make the update. Any ideas why not?

Private Sub MeetingDate_Exit(Cancel As Integer)

'Setting new meeeting date = LastContactDate
Dim UpdatedDate As Date
UpdatedDate = Me![MeetingDate]
Forms![New Friend Input Form Version 7]![New Friend Input Subform Version 1][LastContactDate] = UpdatedDate

End Sub
 
If LastContactDate is on the Main form, why are you refering to a subform?
 
To update the main forms "LastContactDate" field from the addition of contact information. Try This:

Use the After_Insert Event on the Sub form:

Me.Parent.[LastContactDate]=Me.[MeetingDate]
 
Cheers guys-sorry, should have mentioned that the main form I was referencing was a subform aswell.Much appreciated.
 
Sorry-slight problem

I used the following code:

Me.Parent.[LastContactDate] = Me.[MeetingDate]

with the After_Insert event but I'm getting run-time errors when I try to cycle through parent records. The runtime error is 2448-You can't assign a value to this object and possible causes are that the control is on a read only form or the value is too big where neither is the case. Any ideas why I'm getting this?
 

Users who are viewing this thread

Back
Top Bottom