Microsoft KB Archive/140031

= BUG: 16-Bit Data Control Bound to OLE Control Returns Error =

Article ID: 140031

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition

-



This article was previously published under Q140031



SYMPTOMS
A Visual Basic 16-bit program with a data control bound to an OLE container control does not retrieve the data stored in a database. When you try to retrieve the data through the data control, the error message "Error Loading From File" is displayed.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



Step to Reproduce Problem
 Start 16-bit Visual Basic 4.0, or if it is already running, click New Project on the File menu. Add a data control, two command buttons, and an OLE container control to the Form1 form. Set the DataSource property of the OLE container control to the Data1 data control.  Copy the following code sample to the Form1 code window: Private Sub Command1_Click Data1.Recordset.AddNew Ole1.InsertObjDlg End Sub

Private Sub Command2_Click Data1.Recordset.Update End Sub

Private Sub Form_Load Dim db As Database Dim td As TableDef Dim fl As Field

If Dir("C:\OLETEST.MDB") = "" Then Set db = CreateDatabase("C:\OLETEST.MDB", dbLangGeneral) Set td = db.CreateTableDef("OleObjects") Set fl = td.CreateField("Object", dbLongBinary) td.Fields.Append fl           db.TableDefs.Append td            db.Close End If

Ole1.DataField = "Object" Data1.DatabaseName = "C:\OLETEST.MDB" Data1.RecordSource = "OleObjects" Data1.Refresh

Command1.Caption = "&Add New" Command2.Caption = "&Update" End Sub

 On the Run menu, click Start, or press the F5 key to start the program. Click Add New. The error message "OLE Automation error" appears in the OLETEST dialog box. Click OK to close the message box. The Insert Object dialog box is displayed.</li> Use the following steps to insert an object into the OLE container: <ol style="list-style-type: lower-alpha;"> On the Object Type list box, click Paintbrush Picture, then click OK. The Paintbrush window appears.</li> Draw anything in the window.</li> On the File menu, click Exit and return to the (Untitled) menu item. The Paintbrush dialog box is displayed.</li> Click Yes to close the Paintbrush dialog box and the Paintbrush program. The image drawn in the Paintbrush program no longer appears in the OLE container in the Visual Basic program.</li></ol> </li> Click Update. The OLE container is now blank.</li> On the Data1 data control, click Back. While using Microsoft Windows NT or Microsoft Windows 95, the error "Error Loading From File" is displayed. While using Microsoft Windows for Workgroups, a general protection fault occurs.</li></ol>

Additional query words: kbCrtl

Keywords: kbbug kb16bitonly KB140031

-

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

© Microsoft Corporation. All rights reserved.