Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q236469

↑ Back to the top


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

↑ Back to the top


Cause

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

↑ Back to the top


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 Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice

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
				

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Start Microsoft Excel 2000.
  2. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  3. On the Insert menu, click UserForm. This adds a blank UserForm to your project.
  4. On the Tools menu, click Additional Controls.
  5. Click to select the Microsoft ADO Data Control, version 6.0 and the Microsoft DataList Control, version 6.0 check boxes.
  6. Click OK to close the Additional Controls dialog box.
  7. View the control toolbox by clicking Toolbox on the View menu.
  8. Add the ADO Data Control and the DataList control to the UserForm.
  9. Right-click the ADO Data Control, and then click Properties.
  10. 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.
  11. In the Property Pages dialog box, click the General tab.
  12. Click Use Connection String, and then click Build.
  13. In the Data Link Properties dialog box, click Microsoft Jet 4.0 OLEDB Provider, and then click Next.
  14. 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.
  15. In the Property Pages dialog box, click the RecordSource tab.
  16. Under CommandType, click adCmdTable, and under Table or Stored Procedure Name, select a valid table name.
  17. Click OK to close the Property Pages dialog box.
  18. On the View menu, click Code to view the module of the form.
  19. Add the following code to the module of the form:
    Option Explicit
    
    Private Sub UserForm_Initialize()
      DataList1.RowSource = Adodc1
    End Sub
    
    					
  20. On the Run menu, click Run Sub/UserForm.
Note that you receive the error message mentioned in the "Symptoms" section of this article.

↑ Back to the top


Keywords: KB236469, kbprb, kberrmsg, kbdtacode, kbdesigner

↑ Back to the top

Article Info
Article ID : 236469
Revision : 6
Created on : 11/23/2006
Published on : 11/23/2006
Exists online : False
Views : 273