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 for May, 2011

PRB: Type Mismatch with Default Prop of VB4 Data Access Object

Symptoms
Some data access objects in Visual Basic for Windows version 4.0 no longerhave the default “Name” property. Instead, these objects now have a defaultcollection. This change can lead to “Type Mismatch” (Error 13) or “InvalidArgument” (Error 3001) errors when attempting to run your code.
Resolution
To work around this problem, add the name of the property you want toreference.
For example, use this:

MsgBox Data1.Database.TableDefs(0).Name instead of this:

MsgBox Data1.Database.TablesDefs(0)

PRB: Setting ADO Recordset Cachesize with JET OLEDB Provider Returns Error with MDAC 2.1 SP2

Symptoms
Attempting to set the ActiveX Data Objects (ADO) recordset’s Cachesize property returns the following error message:

Run-time error ‘3001′:
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.This error occurs when Microsoft Data Access Component (MDAC) version 2.1 SP2 is installed on the computer and a JET OLEDB provider has been used to create the ADO connection.
Resolution
The current workaround is to use the Microsoft Access ODBC driver when creating the ADO connection.

PRB: Run-Time Error Message 430 with ADO Redistributed Application

Symptoms
When an ADO application is redistributed, it produces the following run-time error on the user’s computer:

Run-time Error 430
Class does not support automation or does not support expected interface.
Resolution
The application references one version of ADO and redistributes a different version of ADO.