Solved

error" The object doesn't contain the automation object ...

Posted on 2003-11-29
18
4,553 Views
Last Modified: 2007-12-19
I am getting the error" The object doesn't contain the automation object "TRdetails".  I saw an exact post of my scenerio, but the guy figure it out on his own ... I don't appear to be that savy.

I have a Form which is for a Treatment Record which is the main form.  This has a subform which has all the treatment details ... from a table TRdetails (the culprit) .. I have the forms linked with Treatment Record.TreatmentID and TRdetails.TreatmentID ....

The wierd thing is is that it gives me this error, and then it allows me to add the record ... well, not really ... at that point i can't figure out how to send the TreatmentID (from the Treatment Record) to the detail line of the subform of the TRdetail.
0
Comment
Question by:tljprincess
  • 5
  • 4
  • 4
  • +3
18 Comments
 
LVL 10

Expert Comment

by:jobrienct
ID: 9844206
Please post your access version, os version, and any sql you are using - are you using macros or vba? and then it would be helpful to know a bit about your table structure including any relationships or referential integrity settings.

JOhn
0
 

Author Comment

by:tljprincess
ID: 9844212
access 2002, os version is windows 2000 .... i am using vba, not macros

it is pretty basic; the treatment record table has the base information and is linked to the subform which uses the TRdetails table ... linked by the treatmentid (text 13 char)
0
 
LVL 10

Expert Comment

by:jobrienct
ID: 9844232
post your vba code please? this error can occur in several ways, including bad syntax. in particular when building strings with sql and forgetting to quote them properly.

John
0
 

Author Comment

by:tljprincess
ID: 9844239
i have setup the main form Treatment Record (from teh tables Treatment Records) and inserted a subform TRsubform (from the table TR details) ... linked on TreatmentID ... there really isn't any code here for me to post, eh?
0
 
LVL 10

Expert Comment

by:jobrienct
ID: 9844271
hrm, then you arent using vba :)

you you have 2 tables and a form, no module code, no querys,
Treatment Record (form) is based on Treatment Record (table)
TRSubform is based on TRDetails

each contain a field named TreatmentID which is (should be ) the primary key in Treament Record (AutoNumber?) and is a number (long int) in TRSubform.

you used the subform object to add the subform to the main form and allowed the link to be established on TreatmentID.

that about sum it up?

perhaps this would be easier if you just sent me the db, however im using access 2000 - can you convert it?
Tools -> Database Utilities -> Convert -> To Prior access verion

If you can then send it along to jobrien AT acscience DOT com

John

0
 
LVL 10

Expert Comment

by:jobrienct
ID: 9844275
er, typo there the line :

each contain a field named TreatmentID which is (should be ) the primary key in Treament Record (AutoNumber?) and is a number (long int) in TRSubform.

should be:

each contain a field named TreatmentID which is (should be ) the primary key in the Treament Record table (AutoNumber?) and is a number (long int) in TRDetails.

and now i see you have already said treamentID is a text field. Is the rest correct?

John
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 9844699
If you have a FK (say Treatment_ID) in you subform, and its SQL return zero records, you will get that kind of error.  This is how I deal with that (depending what even the error occurs in your case, you need apply the concept).

If VarType(Me!SubForm.Form!Treatment_ID)=3 Then   '3 is Long

' It has good value will not cause error

If VarType(Me!SubForm.Form!Treatment_ID)=9 Then   '9 is object

' returns zero records, will produce error

End IF

Mike
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 9844701
correction...

ElseIf VarType(Me!SubForm.Form!Treatment_ID)=9 Then   '9 is object
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 10

Accepted Solution

by:
jobrienct earned 500 total points
ID: 9844766
VarType in this case is 10 apparently. He is using text.

John
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 9844776
John,

I thought text/String is 8.  I guess tljprincess could use:

MsgBox VarType(Me!SubForm.Form!Treatment_ID)

to see what number is paged in each case.  The problem could be something else.

Mike
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 9844855
Hi tljprincess,


If you have any buttons on your forms, then you have code.

Try this to find the source of the error:

Highlight your form in the database window
Menu > View > Code

then:
Menu > View > Options
On the General Tab for Code Options, Tick Break on all errors. Click OK

Then try to make the error happen again, it should open the code window on line that is causing the error.

A quick fix would be to insert a line above the offending line and type:

On Error Resume Next

Then place your cursor on the new line you typed in, and choose:
 Menu > Debug > Set Next Statement

then:
Menu > Run > Run...


Post the offending code block here for further information.
Dont forget to set the options back to break on all unhandled errors when fixed.


Alan :)






0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 9844863
Hi tljprincess,

This is often caused by a field which has a default value that is a Lookup value, but the field for the lookup has been removed or renamed.

Like:
defaultvalue:  = DLast("Unit_Price", "Catalog")

Done any renaming table fields lately?
Alan :)
0
 

Author Comment

by:tljprincess
ID: 9846177
I can't believe that the solution was this easy ... but I went into the subform's query and added the criteria to TRdetails.TreatmentID of Treatment Records.TreatmentID ... and all is fine ... just now the TreatmentID of the TRdetails on the subform is showing as ?Name ... but that automation error is now gone.  Any ideas on the ?Name ???
0
 

Author Comment

by:tljprincess
ID: 9846256
ok, so now i too have figured out the stupid "?Name" issue ... i am not sure how to award points on this ... any advice?
0
 
LVL 33

Expert Comment

by:Mike Eghtebas
ID: 9846296
I don't expect any points because my shot-in-the dark was very off the target.
0
 
LVL 9

Expert Comment

by:ornicar
ID: 10075434
----------------------------------------------------------------------------------------
This question has been abandoned and needs to be finalized.
 You can accept an answer, split the points, or get a refund (information at http:/help.jsp#hs5)
  If you need a moderator to help you, post a question at Community Support (http:/Community_Support/)

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ornicar
Cleanup Volunteer

---------------------------------------------------------------------------------------------
0
 
LVL 32

Expert Comment

by:jadedata
ID: 10106671
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: jobrienct {http:#9844766}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jadedata
EE Cleanup Volunteer
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now