ADODB .Size Failing in Microsoft ActiveX Data Objects 2.8

rickincanada

Board Regular
Joined
Aug 31, 2010
Messages
61
I have a Macro, written by someone else, in an Excel workbook that I distribute, which is failing on Windows XP machines. This is because VBA is attempting to access Microsoft ActiveX Data Objects 6.1, however as I understand it can't be accessed in Windows XP. I'm wondering if anyone here, without having to dig through the entire Macro, could help suggest some alternative to the snippet below? This appears to be the only element I'm relying on that is not available in Microsoft ActiveX Data Objects 2.8. It would appear that the .Size is what's looking for the 6.1 Library.

Code:
Dim cmd As ADODB.Command
...
...
For i = 0 To cmd.Parameters.Count - 1
        If cmd.Parameters.Item(i).Type = adDecimal Then
            cmd.Parameters.Item(i).Precision = cmd.Parameters.Item(i).Size
            cmd.Parameters.Item(i).NumericScale = 4
        End If
    Next i
...
...

Any help you can offer would be greatly appreciated! Thanks in advance.

Rick
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Kyle,

First of all, thanks for your response. I've long suspected that using late binding would be my preferred approach, however I struggle a little to understand exactly this will work. I have a couple questions, can you tell me if I'm understanding this binding stuff correctly?

1. To change to code from above to late binding, would I simple change the Dim cmd As ADODB.Command to Dim cmd as Object and then Set rst = CreateObject("ADODB.Command") and proceed from there?
2. By doing this, how does this avoid users who don't have the same version of Microsoft ActiveX Data Objects available to them as I do from getting an error on workbook open?

Thanks so much for answering these two questions for me. I promise I've out a lot of energy into trying to read and understand other posts on this subject, however these two items are still a little unclear to me.

Rick
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,823
Members
452,672
Latest member
missbanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top