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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with converting from DAO to ADO

Status
Not open for further replies.

vcharles

IS-IT--Management
Jun 29, 2004
21
US
Hi
I'm having problems converting to ADO,listed below is my existing code for DAO, can you please help me figure out the proper code.

DAO Code: "Works"
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("C:\Program Files\Microsoft Visual Studio\VB98\AOPT1.mdb", False, False, "MS Access; PWD=MANXYZ")
Set RS = db.OpenRecordset("aop6a")
SQL = "SELECT DISTINCT SN, AGD1, CTRYX FROM AOP6A WHERE SN like """ & n & "*"" AND CTRYX LIKE " & S & " ORDER BY SN"
Set RS = db.OpenRecordset(SQL, dbOpenSnapshot)
Set Data5.Recordset = RS

ADO Code: (Doesn't work)
Set Db = New ADODB.Connection
Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Password=MANXYZ;Persist Security Info=True;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\AOPT1.mdb"

'Error message from line above:
Can't start your application. The workgroup information file is missing or opened exclusively by another user.

oRS.Open "SELECT * FROM aop6a", Db, adOpenDynamic, adLockReadOnly
Set Adodc1.Recordset = oRS
oRS.Close
Db.close

Can you please help me with the ADO code?

Thanks.

victor

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top