Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to identify if MDAC is loaded on PC

Status
Not open for further replies.

JBuckley

Programmer
Jul 26, 2001
4
US
Within VB how do I tell if MDAC is loaded on a client PC. Then end code I want will be....

If <MDAC not loaded> then
msgbox &quot;Go and load MDAC&quot;
End if


any ideas?????
 
A quick way without searching for installed files/registry entries would be to try to create an object and trap the error.

e.g.
Code:
Dim MDACVersion As String

Private Function MDACInstalled() As Boolean
Dim O As Object
On Error Resume Next
Set O = CreateObject(&quot;ADODB.Connection&quot;)
If Err.Number <> 0 Then     'Error occurred - not installed
    Err.Clear
    MDACInstalled = False
    MDACVersion = &quot;Not Installed&quot;
Else
    MDACVersion = O.Version 'May as well find out the version while it's open
    Set O = Nothing         'Dispose of the object
    MDACInstalled = True
End If
End Function

Private Sub Command1_Click()
If MDACInstalled() Then
    MsgBox &quot;MDAC Version &quot; & MDACVersion & &quot; installed&quot;, vbInformation
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top