pnrjack
05-30-2002, 11:12 AM
Anyreason why after I declare a rs that it would give me the option to use rs.open? .open does not come up as a choice.
Any reason why......pnrjack 05-30-2002, 11:12 AM Anyreason why after I declare a rs that it would give me the option to use rs.open? .open does not come up as a choice. reboot 05-30-2002, 11:14 AM Possibly you don't have a reference to the appropriate object library? pnrjack 05-30-2002, 11:15 AM Do you know which one I would need? Using VB 6 with Access 1997. Anis 05-30-2002, 11:18 AM may be coz, you havent declare it as Dim rs as Adodb.Recordset reboot 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. pnrjack 05-30-2002, 11:20 AM I believe it is a DAO...is 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 rs.MoveLast rs.MoveFirst it is not giving the .open as a choice reboot 05-30-2002, 11:24 AM What you just posted is ADO code. pnrjack 05-30-2002, 11:27 AM I am a little lost as to the difference. What references need to be added with ADO? ScotK 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 Anis 05-30-2002, 11:53 AM Try Adding Data Envionment. It will work. pnrjack 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 Anis 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;" & _ "Pwd=anis;" 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 reboot 05-30-2002, 12:12 PM You're mixing ADO and DAO together. |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum