Any reason why......

05-30-2002, 11:12 AM
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, 11:14 AM
Possibly you don't have a reference to the appropriate object library?

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

05-30-2002, 11:18 AM
may be coz, you havent declare it as

Dim rs as Adodb.Recordset

05-30-2002, 11:19 AM
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, 11:20 AM
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, 11:24 AM
What you just posted is ADO code.

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

05-30-2002, 11:50 AM
"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, 11:53 AM
Try Adding Data Envionment.
It will work.

05-30-2002, 11:57 AM
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, 12: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, 12:12 PM
You're mixing ADO and DAO together.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum