The information in this article applies to:
- Professional and Enterprise Editions of Microsoft Visual Basic,
16-bit only, for Windows, version 4.0
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
- 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.
- Use the following steps to insert an object into the OLE container:
a. On the Object Type list box, click Paintbrush Picture, then click
OK. The Paintbrush window appears.
b. Draw anything in the window.
c. On the File menu, click Exit and return to the (Untitled) menu
item. The Paintbrush dialog box is displayed.
d. 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.
- Click Update. The OLE container is now blank.
- 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.
|