Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘DAO’

PRB: RepairDatabase Method Is No Longer Available in DAO 3.6

Symptoms
If you issue a DbEngine.RepairDatabase method after you change your project references from Microsoft DAO 3.51 Object Library to Microsoft DAO 3.6 Object Library, you may receive the following error message:

Error # 3251 was generated by DAO.DbEngine.
Operation is not supported for this type of object.Or, you may notice that the method is not available through IntelliSense when you issue a DbEngine.RepairDatabase method.
Resolution
In Data Access Object (DAO) 3.6, the RepairDatabase method is no longer available or supported. This is by design to match Microsoft Jet 4.0.

PRB: Jet 4.0 Row-Level Locking Is Not Available with DAO 3.60

Symptoms
According to Microsoft Knowledge Base article 275561?(http://support.microsoft.com/kb/275561/EN-US/) “ACC2000: New Features in Microsoft Jet 4.0″:
To minimize the impact of the increased page size and respond to a long-standing request from developers building applications based on the Microsoft Jet database engine, row-level locking was added to Jet 4.0.However, row-level locking of an Access database is not available with Data Access Objects (DAO) 3.60.
Resolution
To resolve this problem, use ActiveX Data Objects (ADO) to enable row-level locking on an Access database, and then open DAO connections to the database. All subsequent attempts to open DAO connections to the database will respect the locking mode that you set.

BUG: Data Control Errors Do Not Populate Error Object

Symptoms
A “Type Mismatch” error is generated when a control is bound to a fieldwith an incompatible type, but the Error object is not populated when it isexamined in the Data Control Error event.
Resolution
This is a limitation of the Data Control in Visual Basic version 4.0. Whenthe DAO generates an error, the Error object is cleared when the Errorevent for the Data Control is fired.

PRB: FileMon Shows That DAO360.dll Fails to Load MSJet49.dll, MSJet48.dll, and Other MSJetxx.dll Files

Symptoms
When you use FileMon or another utility to monitor file activity, if an application uses DAO 3.6x with Jet 4.0, you receive the following error message:

FILE NOT FOUNDfor the following dynamic-link libraries (DLLs):
MSJET49.DLL
MSJET48.DLL
MSJET47.DLL
MSJET46.DLL
MSJET45.DLL
MSJET44.DLL
MSJET43.DLL
MSJET42.DLL
MSJET41.DLLHowever, you also notice that MSJET40.DLL is loaded successfully.
Resolution
This behavior is by design to allow future Jet 4 functionality to be included into DLLs that are named incrementally. For example, a new version of Jet 4 can be implemented in a DLL named MSJET41.DLL. DAO 3.60 then automatically uses the new version of Jet 4, MSJET41.DLL.
Microsoft Development has found that it does not significantly impact DAO 3.60 or Jet 4.0 performance to load these DLLs.

PRB: CLSID {00000010-0000-0010-8000-00AA006D2EA4} Not Found When You Run an Application

Symptoms
When you first try to run an application that a Visual Basic 6.0 Setup package installed and that the Packaging and Deployment Wizard (PDW) created, you may receive the following error message:

Class not registered.
Looking for object with CLSID {00000010-0000-0010-8000-00AA006D2EA4}.
Resolution
This error occurs when the Visual Basic 6.0 project references the Microsoft Data Access Objects (DAO) 3.6 Object Library (DAO360.dll) and not DAO350.dll. The {00000010-0000-0010-8000-00AA006D2EA4} CLSID is associated with DAO350.dll.
When the intrinsic Data control’s Connect property is set to Access, and the application uses this Data control, the application requires that DAO350.dll is registered on the system. However, DAO350.dll is not included in the distribution package that the PDW creates because it is not referenced in the project.

PRB: Cannot Connect Data Control to a Password-Protected Access Database

Symptoms
If you attempt to use the Data control to connect to a password-protected Access database at design time, you receive the following error message:

Not a valid passwordSpecifically, this error occurs when you set the RecordSource property of the Data control.
Resolution
To use the Data control with a password-protected Access 2000 or later database, you must set the Recordset property of the data control at run time as follows:In your project, click References from the Project menu, and then select the Microsoft DAO 3.6 Object Library check box.In the Form_Load event of your form that contains the Data control, place the following code where “Data1″ is the name of your Data control. Make sure to change the path, table name, and password in the following code to reference your database.

Private Sub Form_Load()Dim db As DAO.DatabaseDim ws As DAO.WorkspaceDim rst As DAO.RecordsetSet ws = DBEngine.Workspaces(0)Set db = ws.OpenDatabase _(“C:\Atest.mdb”, _False, False, “MS Access;PWD=aaa”)Set rst = db.OpenRecordset(“Table1″, dbOpenDynaset)Set Data1.Recordset = rstEnd Sub