INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

automation error when connecting to access

automation error when connecting to access

(OP)
Hi i have the following code:

Dim cn As ADODB.Connection
Dim lngOldCommitMode As Long

Set cn = New ADODB.Connection
If bUseSlash = True Then
cn.Open "OLE DB Services=-4;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\" & DBServer & "\" & DBPath & "\" & DBName & ".mdb"
Else
cn.Open "OLE DB Services=-4;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\My Documents\DG Software\LHScanning.mdb"
End If
lngOldCommitMode = cn.Properties("Jet OLEDB:Transaction Commit Mode")
cn.Properties("Jet OLEDB:Transaction Commit Mode") = 1

sSql = "UPDATE LockersLive SET Allocated = True WHERE BlockId = " & rs.Fields("BlockId") & " AND Isle = " & rs.Fields("Isle") & " AND Side = " & rs.Fields("Side") & " AND Row = " & rs.Fields("Row") & " AND Column = " & rs.Fields("Column")
cn.Execute sSql, , adExecuteNoRecords

cn.Properties("Jet OLEDB:Transaction Commit Mode") = lngOldCommitMode
cn.Close


on my windows 7 pc i get class not supported automation error. Im guessing its an ADO issue.

CAn anybody help please

thanks in advance

RE: automation error when connecting to access

At what point does the error occur?

Does this error happen when you have only this code in a small test app or when you have other apps or processes running?
I use similar code but don't have the "OLE DB Services=-4;" statement in it and it works in win7

May have no connection but I had a similar "automation error" issue with similar code but only when I also had a web camera running!

RE: automation error when connecting to access

(OP)
Hi Thanks for the reply.

I recompiled the vb app on a XP Virtual PC and it fixed the problem.

Thanks

RE: automation error when connecting to access

RE: automation error when connecting to access

Note that if you set a reference to ADO in the VB6 IDE while working on a Win7 SP1 machine you will be able to compile and run there. But you've built a time bomb that will go off when your program is deployed anywhere but a Win6.1 SP1 system.

Then we get yet another question like this.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close