Run-time error 2448 (1 Viewer)

aproctorpe001

Registered User.
Local time
Today, 07:32
Joined
Nov 19, 2001
Messages
17
I have subform(Meetings) nested in a subform(Contacts) nested in a main form(Employees).

I am trying to update the field LastContactDate on the Contacts subform when a meeting has been added on the Meetings subform. The field updates but when I try to switch to next employee I get this error.

I used the following code:

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

with the After_Insert event. 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?
 
R

Rich

Guest
Try removing the brackets, and change the name of the fields to something other than the control names
Me.Parent.txtLastContDte = Me.txtMeetDte
 

aproctorpe001

Registered User.
Local time
Today, 07:32
Joined
Nov 19, 2001
Messages
17
Won't that mean the compiler won't recognise the text box field on the parent form?
 
R

Rich

Guest
I've just done it using the method I gave you without any errors. I do wonder though why you are storing duplicate data?
 

aproctorpe001

Registered User.
Local time
Today, 07:32
Joined
Nov 19, 2001
Messages
17
Unfortunately, this run-time error has reared its ugly head again-can anyone tell me why this keeps happenning and is there anything else I can try to remedy it?
 
R

Rich

Guest
You didn't answer why you need to store the date again, it's not neccessary.
 

aproctorpe001

Registered User.
Local time
Today, 07:32
Joined
Nov 19, 2001
Messages
17
Sorry Rich, let me explain what I'm trying to do. I have a one to many relationship between Contacts and Meetings(A Contact can have many meetings). In the Contacts table I have a field :LastContactDte which stores the date when the Contact last met with one of our employees. I then have a subform in the Contacts form where the user can input details of new meetings, including the field MeetingDte. When a new meeting is added, I want to update the LastContactDte field on the Contacts form with that of the new meeting on the Meetings sub form. I hope that makes a little more sense.

Thanks

Alex
 
R

Rich

Guest
You are storing duplicate date, the dates are already stored in the meetings table and can be retrieved at any time via a query using the Max function or since you want to display the last date, delete the field from the Contacts table delete the text box, add an unbound text box set control source to =DMax("DteField","Meetings","([ContactID] = " & [Forms]![MainFrmName]![SubformName]![ContactID] & ")").
HTH
 

aproctorpe001

Registered User.
Local time
Today, 07:32
Joined
Nov 19, 2001
Messages
17
I can't get the expression to work. Seems to be complaining about the dot operator '.HTH' at the end of the expression. Any ideas?
 
R

Rich

Guest
=DMax("DteField","Meetings","([ContactID] = " & [Forms]![MainFrmName]![SubformName]![ContactID] & ")")<end of statement
HTH Hope This Helps
 

aproctorpe001

Registered User.
Local time
Today, 07:32
Joined
Nov 19, 2001
Messages
17
Thanks-Sorry but still having problems. That seems to work on it own but the proble seems to be becuse I have 2 levels of subforms. The main form is Employees, the subform is Contacts and the second subform is Meetings. The control that needs to be updated is in the first Subform(Contacts)and the Meeting Date field is in the second nested subform. When I open up the 1st Subform the control populates as required. However when I open up the main form, I get the #Name? error in the control. Any ideas-thanks for all the help so far.
 
R

Rich

Guest
Have you tried =DMax("DteField","Meetings","([ContactID] = " & [Forms]![MainFrmName]![SubformName]![2ndSubForm]![ContactID] & ")")
 

PraizesLiberato

Registered User.
Local time
Today, 10:32
Joined
Dec 6, 2009
Messages
69
You control may not be referenced to the Table. i hope you already found the solution. check your forms query. have a good day.;)
 

Users who are viewing this thread

Top Bottom