DOCUMENT:Q257947 24-FEB-2001 [vbwin] TITLE :PRB: Runtime Error 7 : Out of Memory Error Message PRODUCT :Microsoft Visual Basic for Windows PROD/VER::6.0,6.0 SP3,6.0 SP4 OPER/SYS: KEYWORDS:kbVBp600 kbGrpDSVBDB ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Enterprise Edition for Windows, versions 6.0, 6.0 SP3, 6.0 SP4 - Microsoft Visual Basic Professional Edition for Windows, version 6.0 ------------------------------------------------------------------------------- SYMPTOMS ======== If you try to access the BoundText property of a Data Combo control in Visual Basic code after you scroll down the list of elements in its list portion until the currently selected element is no longer visible in the list, the following error message is displayed: Runtime Error '7': Out of Memory CAUSE ===== The cause of this behavior is unknown. RESOLUTION ========== Write code in the Click event of the Data Combo to store the value of the its BoundText property in a form-level variable. Use the form-level variable to access the value of the Data Combo's BoundText property. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- The following steps reproduce this error: 1. Open a new Data project in Visual Basic. Drag-and-drop a Data Combo control, two ADO Data controls, and a CommandButton onto the form that is added to the project (frmDataEnv). 2. Set the Style property of the Data Combo to one of the following: - dbcDropdownCombo - dbcDropdownList 3. Set the ConnectionString property of the first ADO Data control (ADODC1) to connect to the Nwind.mdb database that is located in the Visual Basic 98 folder. Specify the Products table in the Nwind.mdb database as its RecordSource. 4. Set the ConnectionString property of the second ADO Data control (ADODC2) to also connect to the Nwind.mdb database that is located in the Visual Basic 98 folder. Specify the Suppliers table in the Nwind.mdb database as its RecordSource. 5. Set the following properties of the Data combo as specified below: - DataSource - ADODC1 - DataField - SupplierID - RowSource - ADODC2 - ListField - CompanyName - BoundColumn - SupplierID 6. Cut-and-paste the following line of code into the Click event of the CommandButton: MsgBox DataCombo1.BoundText 7. Save and run the Visual Basic project, and note that the Data Combo displays a List of CompanyNames from the Suppliers table. 8. Click the drop-down button on the Data Combo to display the list portion of the control, and then scroll down the list of items by using the vertical scroll bar until the currently selected element in the Data Combo is no longer visible in the elements that are displayed in the list portion of the control. 9. Click the CommandButton, and note that this collapses the list portion of the Data Combo control and generates the run-time error message noted in the "Summary" section of this article. Stop the execution of the project and return to the Visual Basic environment. 10. Declare a string variable by the name of BoundText in the form's General Declarations section. Cut-and-paste the following line of code in the Click event procedure of the Data Combo: BoundText = DataCombo1.BoundText 11. Modify the MsgBox statement in the Click event procedure of the Command Button to display the value of the BoundText variable instead of the BoundText property of the Data Combo. 12. Repeat steps 8 through 11, and note that the error message does not occur and that the value of the variable that is displayed reflects the value in the BoundText property of the Data Combo control. Additional query words: DataGrid Runtime 7 ====================================================================== Keywords : kbVBp600 kbGrpDSVBDB Technology : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB600Search kbVB600 kbVB600SP3 kbVB600SP4 Version : :6.0,6.0 SP3,6.0 SP4 Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2001.