BUG: 16-Bit Data Control Bound to OLE Control Returns Error (140031)



The information in this article applies to:

  • Microsoft Visual Basic Professional Edition, 16-bit, for Windows 4.0
  • Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows 4.0

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.

MORE INFORMATION

Step to Reproduce Problem

  1. Start 16-bit Visual Basic 4.0, or if it is already running, click New Project on the File menu.
  2. Add a data control, two command buttons, and an OLE container control to the Form1 form.
  3. Set the DataSource property of the OLE container control to the Data1 data control.
  4. 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
    
    					
  5. On the Run menu, click Start, or press the F5 key to start the program.
  6. 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.
  7. Use the following steps to insert an object into the OLE container:
    1. On the Object Type list box, click Paintbrush Picture, then click OK. The Paintbrush window appears.
    2. Draw anything in the window.
    3. On the File menu, click Exit and return to the (Untitled) menu item. The Paintbrush dialog box is displayed.
    4. 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.
  8. Click Update. The OLE container is now blank.
  9. 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.

Modification Type:MajorLast Reviewed:10/15/2002
Keywords:kb16bitonly kbbug kbDSupport KB140031