Retrieve ADO or MDAC version

Applies To

OS:
VB:
NT, 9x, 2000
5, 6

Here is a little routine to retrieve ADO (aka MDAC) version or to see if it installed on the system. This function can be called from anywhere. It returns an empty string if ADO is not installed. Scroll down for code.

Add the following function to Module, Class or Form
 

Function GetAdoVersion() As String
    'Returns an empty string is ADO is not installed
    Dim o As Object
    
    On Error Resume Next
    Set o = CreateObject("ADODB.Connection")
	
    If Err.Number = 0 then
        GetAdoVersion = o.Version
    Else
        'ADO is not installed
    End If

End Function