Works with Access 97 but not Access 2k

dcbeere
10-20-2000, 05:05 PM
I am using a list box to display touples from an Access 2000 database. I am using an ADO control. The touples are displayed fine, but when one is clicked it does not pass the other attributes to other textboxes. It gets hung up on the OpenDatabase command, I get a run-time error (3343) that says that it is a unrecognized database format. The following code works perfectly using Access 97 and a DAO control. How can I make this work with Access 2000 and an ADO control?

Private Sub DataList1_Click()
Dim db As Database
Dim rs1 As Recordset
Dim s1 As String

cName = DataList1.Text

Set db = OpenDatabase("C:db1.mdb") 'ERROR IS HERE

s1 = "SELECT * FROM Table1 WHERE Table1.name = '" & cName & "'"

Set rs1 = db.OpenRecordset(s1)

zipCode = rs1("zip")

Text2.Text = zipCode

Set db = Nothing
End Sub

xena
10-21-2000, 06:33 PM
What's your workspace?

Set db = workspace.OpenDatabase("C:db1.mdb")

:)

whelanp
10-24-2000, 06:11 AM
Declare you Db Vars as

dim rs as DAO.Recordset
dim db as DAO.Database

ca8msm
10-27-2000, 07:37 AM
I had same problem. Download Service Pack 4.0 from www.microsoft.com and all will be fixed. (55Mb)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum