Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-11-29
18
Medium Priority
?
4,575 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
17 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

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 34

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 34

Expert Comment

by:Mike Eghtebas
ID: 9844701
correction...

ElseIf VarType(Me!SubForm.Form!Treatment_ID)=9 Then   '9 is object
0
 
LVL 10

Accepted Solution

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

John
0
 
LVL 34

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 34

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

824 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