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!

ADO CONNECTION PROBLEM IN VB 6

Status
Not open for further replies.

dosun

Programmer
Oct 15, 2003
11
US
I am getting the following error with the code below:
"Error 430 Class does not support Automation or does not support expected interface"

I have used this code in many VB6 programs, and never had a problem until a few days ago (I am now having the problem on a Customer's Windows XP workstation and on my own Windows Virtual XP)

Does anyone know what to do to resovle this ?

Option Explicit
Private mconMas90 As New ADODB.Connection
Private mstrMas90CompanyNumber As String

Private Sub COMMAND1_CLICK()
On Error GoTo ErrorHandling
mstrMas90CompanyNumber = "ABC"

With mconMas90
.Mode = adModeShareDenyNone
.CursorLocation = adUseClient
.ConnectionString = "Provider=MSDASQL.1;COMPANY=" & mstrMas90CompanyNumber & ";" & "Password=sunbelt2004;Persist Security Info=True;User ID=sunbelt;Data Source=SOTAMAS90"
.Open
End With

MsgBox "OPENED OK"
mconMas90.Close
Exit Sub
ErrorHandling:
MsgBox "Unexpected error in OpenMas90: " _
& "Error " & Err.Number _
& " " & Err.Description
Exit Sub
End Sub

 
I have occasionally got the same error when the same database has been used and not closed by another program even though that program is closed. Only if I reboot the computer can I clear it and it doesnt occur again.

Although different to yours, this is my connection for a datagrid to a database mdb
Dim CN As ADODB.Connection ' Conection tool for Locations
Dim RS As ADODB.Recordset ' Recordset tool for Locations
CN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\" & StationIP & "\c\MyMessages.mdb"
RS.CursorLocation = adUseClient
RS.Open "SELECT * FROM tblMessages ORDER BY MessageNumber;", CN, adOpenStatic, adLockOptimistic
Set MessageGrid.DataSource = RS
 
Thanks for the responses.

I got around the problem by compiling on my Windows XP Virtual PC.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top