Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 11-21-2001, 05:45 AM   #1
aproctorpe001
Junior Member
 
Join Date: Nov 2001
Location: UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
aproctorpe001
Run-time error 2448

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?

aproctorpe001 is offline   Reply With Quote
Old 11-21-2001, 05:56 AM   #2
Rich
Guest
 
Posts: n/a
Try removing the brackets, and change the name of the fields to something other than the control names
Me.Parent.txtLastContDte = Me.txtMeetDte

  Reply With Quote
Old 11-21-2001, 09:00 AM   #3
aproctorpe001
Junior Member
 
Join Date: Nov 2001
Location: UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
aproctorpe001
Won't that mean the compiler won't recognise the text box field on the parent form?

aproctorpe001 is offline   Reply With Quote
Old 11-21-2001, 12:00 PM   #4
Rich
Guest
 
Posts: n/a
I've just done it using the method I gave you without any errors. I do wonder though why you are storing duplicate data?
  Reply With Quote
Old 11-22-2001, 08:18 AM   #5
aproctorpe001
Junior Member
 
Join Date: Nov 2001
Location: UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
aproctorpe001
Thanks-worked a treat
aproctorpe001 is offline   Reply With Quote
Old 11-23-2001, 09:21 AM   #6
aproctorpe001
Junior Member
 
Join Date: Nov 2001
Location: UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
aproctorpe001
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?
aproctorpe001 is offline   Reply With Quote
Old 11-23-2001, 10:53 AM   #7
Rich
Guest
 
Posts: n/a
You didn't answer why you need to store the date again, it's not neccessary.

  Reply With Quote
Old 11-27-2001, 03:19 AM   #8
aproctorpe001
Junior Member
 
Join Date: Nov 2001
Location: UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
aproctorpe001
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
aproctorpe001 is offline   Reply With Quote
Old 11-27-2001, 04:59 AM   #9
Rich
Guest
 
Posts: n/a
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
  Reply With Quote
Old 11-28-2001, 04:05 AM   #10
aproctorpe001
Junior Member
 
Join Date: Nov 2001
Location: UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
aproctorpe001
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?
aproctorpe001 is offline   Reply With Quote
Old 11-28-2001, 05:59 AM   #11
Rich
Guest
 
Posts: n/a
=DMax("DteField","Meetings","([ContactID] = " & [Forms]![MainFrmName]![SubformName]![ContactID] & ")")<end of statement
HTH Hope This Helps
  Reply With Quote
Old 11-28-2001, 08:24 AM   #12
aproctorpe001
Junior Member
 
Join Date: Nov 2001
Location: UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
aproctorpe001
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.
aproctorpe001 is offline   Reply With Quote
Old 11-28-2001, 10:45 AM   #13
Rich
Guest
 
Posts: n/a
Have you tried =DMax("DteField","Meetings","([ContactID] = " & [Forms]![MainFrmName]![SubformName]![2ndSubForm]![ContactID] & ")")
  Reply With Quote
Old 03-14-2010, 04:20 AM   #14
PraizesLiberato
Newly Registered User
 
PraizesLiberato's Avatar
 
Join Date: Dec 2009
Posts: 69
Thanks: 4
Thanked 0 Times in 0 Posts
PraizesLiberato is on a distinguished road
Re: Run-time error 2448

You control may not be referenced to the Table. i hope you already found the solution. check your forms query. have a good day.
PraizesLiberato is offline   Reply With Quote
Old 03-14-2010, 04:21 AM   #15
PraizesLiberato
Newly Registered User
 
PraizesLiberato's Avatar
 
Join Date: Dec 2009
Posts: 69
Thanks: 4
Thanked 0 Times in 0 Posts
PraizesLiberato is on a distinguished road
Re: Run-time error 2448

hehe..wow...thats was logn ago.

PraizesLiberato is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 06:34 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World