Visual Basic 6.0 Error: ‘Compile Error: Procedure declaration does not match description of event or procedure having the same name’

System Requirements:

  • Visual Basic 6.0

The Problem:

After copying a control placed on a form in the VB 6.0 IDE you receive the following error message when you attempt to run the program.

Compile error:

Procedure declaration does not match description of event of procedure having the same name

Compile Error Message

The program will not compile correctly even after the VB control that you copied has been deleted from the form.

More Info

This seems to be a bug in the VB 6.0 IDE. Remember this?

Create Control Array Message

It asked you if you wanted to place the control into an array so that multiple controls named ‘Command1’ in this case could be referenced from a common name i.e. Command1(0), Command1(1), Command1(2) etc.

Very occasionally the VB IDE gets this wrong, attempting to reference a control variable as an array variable. This in turn leads to non-compliable code and no clear way to get out of the problem.

The Fix

The fix is to prevent the VB IDE from trying to treat the original variable as an array by removing its index parameter.

  1. Delete or rename the duplicate named control
  2. Note the name of the control in the error message
  3. Save your project and exit VB
  4. Open the location of your .vpb (Visual Basic Project) file
  5. Locate the .frm file (form) that your control appears in amongst the list of files
  6. Open notepad and drag and drop the .frm file into its window so that you can see the underlying code-behind the form
  7. Search the file for the name of the control named in the error message
  8. Beneath it you should find a parameter list associated with the control. Locate and delete the line “Index” line as highlighted below
  9. Save and exit notepad and restart the IDE

Or, if the control exposes it, clear the value of ‘index’ on the properties explorer in the IDE.

The Fix in Notepad

Error 0x80070005 when using SWbemLocator.ConnectServer to initiate a WMI session despite using the correct username and password

System Requirements:

  • WMI 1.5 or higher
  • Windows 95, 98, 98SE, Millennium
  • Windows NT 4.0, 2000, XP, 2003, Vista, 2008, 7

The Problem:

When using WMI’s SWbemLocator.ConnectServer class to log onto a remote system, you receive an 0x80070005 access denied error (Decimal -2147024891).

This error occurs even though the username and password are correct and the account credentials are synchronised properly between the local and remote machine – either by domain or manually in a workgroup.

More Info

The classfull connection line for using SWbemLocator is:

Set objWMIService = objSWbemLocator.ConnectServer(<computerName>, <wmiDefaultClassPath>, <username>, <password>)

for example:

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "Administrator", "12345abcde")

The Fix

There is a very good chance that the problem you are having is to do with the username you are entering. You need to ensure that you are prefixing the username with the logon domain.

For example if your domain is camie.local your username should be camie\Administrator

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "camie\Administrator", "12345abcde")

But I’m using a workgroup!

Don’t worry, you can do one of three things.

  1. Prefix the remote machine name (the local logon domain)
  2. Prefix the workgroup
  3. Send a null logon domain
Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "myHostName\Administrator", "12345abcde")

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "workgroup\Administrator", "12345abcde")

Set objWMIService = objSWbemLocator.ConnectServer("192.168.0.100", "root\cimv2", "\Administrator", "12345abcde")

Using one of the above, you should be able to connect to the remote workstation. If you are dealing with a mix of workgroups or cannot know the hostname in advance I suggest using \<username> with I have tested to work on Windows 95 right through to Windows 7.

Uninstalled WD SES Device USB Device appears in device manager with Western Digital Passport ‘Smartware’ enabled device

System Requirements:

  • Western Digital Smartware enabled USB device

The Problem:

When you install a Western Digital USB hard drive an uninstalled device appears in “other devices” in the Windows device manager.

More Info

The WD SES Device USB Device is a enclosure communication and feedback device which, when enabled allows the USB enclosure to communicate additional metrics about the state of the equipment. In this case, the USB enclosure is the USB Caddy containing the 2.5″ drive.

SES stands for SCSI Enclosure Services, which provide extensions to the SCSI command set to allow for reporting and querying of data such as power consumption and state and cooling performance and thermal state within the caddy. The commands are used for diagnostic purposes and are not required in the functionality of the drive or data I/O itself.

You can continue to use the drive without this driver installed. In the case of Western Digital, its main purpose is to facilitate value added features in the Smartware management software.

The Fix

You can find the driver on the 614MB UDF partition that appears with the data storage volume in My Computer. Point the driver installation Wizard at the UDF partition, or more specifically to X:\Extras\WD SES Device Driver where X: is the mounted driver letter for the UDF partition labeled “WD SmartWare”.

The WD SES Driver version shipping with drives containing WD Smartware 1.2.0.8 and with the update (3.1.0.13) available from wdc.com is version 1.0.7.2. It is available for both x86 and x64 systems.

Microsoft JET Database Engine error ‘80040e21’ – Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

System Requirements:

  • Windows NT 4.0
  • Windows 2000
  • Windows XP
  • Windows Server 2003
  • Windows Vista
  • Windows Server 2008
  • Windows 7

The Problem:

When you attempt to connect to a Microsoft Access database using the ODBC provider Microsoft.Jet.OLEDB.4.0 you receive the error message:

Microsoft JET Database Engine error ‘80040e21’
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done./path/file.asp, line ##

 

More Information:

There are a number of issues that can cause this error, they are poorly documented elsewhere online but the information is there; connection string, registry values slightly offset and so fourth. This document deals with one specific issue which is related to the idea of this being caused by an incompatible type value.

The chances of you running into this are quite extreme, however it is an issue in JET (Microsoft Access) that doesn’t exist in Microsoft SQL Server and thus if you are dealing with code transitioning you may want to know about the problem in this very extreme and unlikely situation.

You shouldn’t need to reboot to solve the problem, it didn’t in my case. However, if nothing happens do restart before progressing to the next step.

SQL Example

The following SQL Statement will execute on Microsoft SQL Server and return a RecordSet however the same SQL on JET 4.0 will result in the error message outlined above.

SELECT
Student.StudentID,
Student.FirstName,
Student.LastName,
Student.EMail,
null AS studentPhotoBLOB,
Left(StudentID,1) AS YearPrefix
FROM Student;

No, it isn’t the T-SQL LEFT() statement that is the problem. The issue lies in the “null AS studentPhotoBLOB”.

The idea behind this is that space has been reserved in the record set. Why would you want to do this? If you want to drop the record set directly into an array, then ADO can do this for you using the GetRecords method. However if you want to change the structure you have to re-parse the array and relocate the data into a new structure. You can inset a null named record and use the space in the GetRecords array later for other purposes.

The problem here is that null is not a data type that is supported by JET; it is supported by Microsoft SQL Server however.

The simplest way to remedy the situation is to either change the SQL or dynamically detect JET to change the variable type to a commonly supported data type, for example a String.

SELECT
Student.StudentID,
Student.FirstName,
Student.LastName,
Student.EMail,
” AS studentPhotoBLOB,
Left(StudentID,1) AS YearPrefix
FROM Student;

This is naughty, however in a weak typed language such as ASP it isn’t a real problem given the situation outlined above. The use of ” instead of null forces the data type of the column into a string and thus it can be parsed by JET.