Any reason why......

05-30-2002, 12:12 PM
Anyreason why after I declare a rs that it would give me the option to use .open does not come up as a choice.

05-30-2002, 12:14 PM
Possibly you don't have a reference to the appropriate object library?

05-30-2002, 12:15 PM
Do you know which one I would need? Using VB 6 with Access 1997.

05-30-2002, 12:18 PM
may be coz, you havent declare it as

Dim rs as Adodb.Recordset

05-30-2002, 12:19 PM
Depends on what you're using. ADO, DAO, ? For instance, if ADO, go under your Project->References menu and select the ADO reference.

05-30-2002, 12:20 PM
I believe it is a it the same for that? I tried
Dim rs as dao.recordset and the following code but no luck:

strSQL = "SELECT * FROM Products"
rs.Open strSQL, dbs, adOpenForwardOnly, adLockReadOnly

it is not giving the .open as a choice

05-30-2002, 12:24 PM
What you just posted is ADO code.

05-30-2002, 12:27 PM
I am a little lost as to the difference. What references need to be added with ADO?

05-30-2002, 12:50 PM
"Microsoft ActiveX Data Objects 2.5 Library". Your version may be different, I think 2.7 is the latest but someone will correct me if I'm wrong

05-30-2002, 12:53 PM
Try Adding Data Envionment.
It will work.

05-30-2002, 12:57 PM
How would I DIM these, right now I have...
Dim Data1 As Database
Dim rs As New ADODB.Recordset

and it is giving me a type mismatch with form load:
Set Data1 = OpenDatabase(App.Path & "\TechHeadsDb1.mdb")
Set rs = Data1.OpenRecordset("Products", dbOpenDynaset)

Thanks for your help

05-30-2002, 01:04 PM
Here is a Sample code for you..

Dim con As ADODB.Connection
Set con = New ADODB.Connection
con.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=c:\anis.mdb;" & _
"Uid=admin;" & _
Dim sql As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
sql = "select * from employee order by name"
rs.Open sql, con

05-30-2002, 01:12 PM
You're mixing ADO and DAO together.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum