Microsoft KB Archive/236469

= MOD2000: Error Binding Recordset to RowSource Property of DataList or DataCombo Control =

Article ID: 236469

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Office 2000 Developer Edition
 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q236469



SYMPTOMS
When you add a DataList or DataCombo control to a UserForm, you are unable to bind the control to a recordset at design time. When you try to bind a recordset to the RowSource property of the control at run time, you receive the following error message:

Run-time error '438':

Object doesn't support this property or method



CAUSE
This problem occurs because the RowSource property of the control conflicts with the built-in RowSource property of the UserForm.



RESOLUTION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

In order to bind a DataList or DataCombo control to a recordset, you must explicitly dimension a variable of the type of control that you are working with, and then set the variable to the control on your UserForm. The following example illustrates this technique:

NOTE: This example assumes that your UserForm contains a DataList control named DataList1 and an ADO Data Control named Adodc1. Dim dlDataList as DataList

Set dlDataList = DataList1 Set dlDataList.RowSource = Adodc1



Steps to Reproduce Behavior
 Start Microsoft Excel 2000. On the Tools menu, point to Macro, and then click Visual Basic Editor. On the Insert menu, click UserForm. This adds a blank UserForm to your project. On the Tools menu, click Additional Controls. Click to select the Microsoft ADO Data Control, version 6.0 and the Microsoft DataList Control, version 6.0 check boxes. Click OK to close the Additional Controls dialog box.</li> View the control toolbox by clicking Toolbox on the View menu.</li> Add the ADO Data Control and the DataList control to the UserForm.</li> Right-click the ADO Data Control, and then click Properties.</li> Click in the Custom property box, and then click the Build (...) button next to the Custom property to display the control's Property Pages dialog box.</li> In the Property Pages dialog box, click the General tab.</li> Click Use Connection String, and then click Build.</li> In the Data Link Properties dialog box, click Microsoft Jet 4.0 OLEDB Provider, and then click Next.</li> Enter the path to a valid Jet 4.0 database on your computer, such as the sample database Northwind.mdb that is included with Microsoft Access, and then click OK.</li> In the Property Pages dialog box, click the RecordSource tab.</li> Under CommandType, click adCmdTable, and under Table or Stored Procedure Name, select a valid table name.</li> Click OK to close the Property Pages dialog box.</li> On the View menu, click Code to view the module of the form.</li>  Add the following code to the module of the form: Option Explicit

Private Sub UserForm_Initialize DataList1.RowSource = Adodc1 End Sub

</li> On the Run menu, click Run Sub/UserForm.</li></ol>

Note that you receive the error message mentioned in the "Symptoms" section of this article.

Additional query words: pra prb run time error 438

Keywords: kbdesigner kbdtacode kberrmsg kbprb KB236469

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.