Microsoft KB Archive/177908

= ADT/ODE: There Is "No Object in this Control" Error Message =

Article ID: 177908

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft Access Developer's Toolkit 1.1
 * Microsoft Office 97 Developer Edition

-



This article was previously published under Q177908



Advanced: Requires expert coding, interoperability, and multiuser skills.



SYMPTOMS
When you use an ActiveX control in a Microsoft Access application, the control may appear blank when the application is used in the run-time environment. You may also receive the following error messages

Run-time error '438': Object doesn't support this property or method

-or-

Run-time error '2683': There is no object in this control

-or-

Run-time error '2455': Application-defined or object-defined error

followed by:

Execution of this application has stopped due to a run-time error. The application can't continue and will be shut down.

Your application then quits. The error you receive depends on both the ActiveX control and the version of the developer tools that you are using to distribute the application.



CAUSE
You have pasted a copy of an existing ActiveX control into your form.



RESOLUTION
You can resolve this error by deleting the failing control from the form and adding a new control from the Insert menu. You should then rename the newly placed control to the same name as the old control so that any code existing on the form will work properly.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Open Microsoft Access and create a blank database. Import the Customers, Employees, and Orders tables from the Northwind sample database. The default location for the Northwind database is:

C:\Program Files\Microsoft Office\Office\Samples\Northwind.mdb

 Create a blank form, insert a Listview control and name it ListV.  Type or paste the following code into the form's code module. Private Sub Form_Load

Dim clmX As ColumnHeader, mydb As Database, myrs As Recordset Dim itmX As ListItem

Set mydb = CurrentDb Set myrs = mydb.OpenRecordset("Customers", dbOpenDynaset) Set clmX = ListV.ColumnHeaders.Add(,, "Company", ListV.Width / 3) Set clmX = ListV.ColumnHeaders.Add(,, "Address", ListV.Width / 3) Set clmX = ListV.ColumnHeaders.Add(,, "Phone", ListV.Width / 3) ListV.BorderStyle = ccFixedSingle

While Not myrs.EOF

Set itmX = ListV.ListItems.Add(,, CStr(myrs!CompanyName)) If Not IsNull(myrs!Address) Then itmX.SubItems(1) = CStr(myrs!Address) ' Address field. End If

If Not IsNull(myrs!Phone) Then itmX.SubItems(2) = myrs!Phone ' Phone field. End If

myrs.MoveNext

Wend

ListV.View = lvwReport

End Sub

Private Sub ListV_ColumnClick(ByVal ColumnHeader As Object)

ListV.SortKey = ColumnHeader.Index - 1 ListV.Sorted = True

End Sub

Private Sub ListV_ItemClick(ByVal Item As Object)

Select Case Item.Index

Case Is <= 15 Exit Sub

Case Is >= 15 ' Toggle Ghosted property. Item.Ghosted = Abs(Item.Ghosted) - 1

End Select

End Sub  Save the form as ListVForm.</li> Open the form. The list should display without errors.</li> Create a new blank form and copy the ListV control from the previously saved form.

NOTE: It is important that you copy only the control, not the whole form. Do not insert the control from the Insert menu.</li> Type or paste the code listed in step 4 into this new form.</li> Save the form as ListVCTlCopy.</li> Open the form. The list should display without errors.</li> Create a new form with a command button to open the ListVForm form and another command button to open the ListVCtlCopy form.</li> Save this form as MenuForm and in the Startup dialog box make it the Display Form.</li> Create a distribution disk set using the Setup Wizard and distribute the application to a clean Windows 95 computer. Make sure to include the ActiveX control file (.ocx) in the list of distribution files.</li></ol>

When you run this application on the clean computer, the ListVForm form will work without any errors, but the ListVCtlCopy form will produce the errors described in the "Symptoms" section of this article.

<div class="references_section">